mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-27 02:05:26 +08:00
Context: The `btn` mixin is used for every functional button, but this includes button elements that are not, or should not be, styled like our default or primary buttons. To change how this works this commit: * stripped down the mixin to the bare essentials, mainly limiting to the properties that use variables. * moved most things into the `btn` class * moved some things into specific descriptive classes (default, danger, success) such as border-radius Example of button that does not need a border-radius and would benefit from this: <img width="464" height="184" alt="CleanShot 2025-09-19 at 12 56 04@2x" src="https://github.com/user-attachments/assets/e908b2cf-971f-4c1f-aade-7492bad2f89c" /> * Deprecated… * FlatButton component * btn-active: we should use the proper pseudoclass :active or a –-active modifier in code if we need it * btn-text: every button by default is a btn-text. We already have a class to indicate when it isn’t (no-text) * fixed btn-link property to make DButton component behave like an inline link (no padding, link-styling) * Since I moved styling from .btn, ths means every button now needs a specific declaration. So I’ve added btn-default where necessary. * Fixed btn-flat hover effect: The difference between btn-flat and btn-transparent was getting very ambiguous. I’ve fixed the hover effect for btn-flat so that the distinction is: <img width="1094" height="408" alt="image" src="https://github.com/user-attachments/assets/addf56a9-1f61-463d-abd9-5028a3b88fad" /> * Changed the custom icon colour from header icons so it follows the normal btn-flat styling, the way the sidebar icon already was doing. (Consistency) **Other small button-related change along the way** What | BC | AC | |----| ----|--------| Inconsistent save/cancel colours | <img width="1720" height="1084" alt="CleanShot 2025-09-19 at 15 31 40@2x" src="https://github.com/user-attachments/assets/227289c3-6ded-4633-868d-6e33c32d83c3" /> | <img width="1720" height="1084" alt="CleanShot 2025-09-19 at 15 30 56@2x" src="https://github.com/user-attachments/assets/b23f96c9-04f3-40ea-9fba-2be59eae8e64" /> | --------- Co-authored-by: Martin Brennan <martin@discourse.org>
535 lines
9.6 KiB
SCSS
Vendored
535 lines
9.6 KiB
SCSS
Vendored
@use "lib/viewport";
|
|
|
|
.d-header-wrap {
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: z("header");
|
|
}
|
|
|
|
.d-header {
|
|
display: flex;
|
|
align-items: center;
|
|
flex-direction: column;
|
|
width: 100%;
|
|
background-color: var(--header_background);
|
|
box-shadow: var(--shadow-header);
|
|
backface-visibility: hidden; /** do magic for scrolling performance **/
|
|
height: 3.66em;
|
|
|
|
@include viewport.from(sm) {
|
|
height: 4em;
|
|
}
|
|
|
|
> .wrap {
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
height: 100%;
|
|
padding: 0 var(--d-header-padding-x);
|
|
|
|
.contents {
|
|
display: flex;
|
|
align-items: center;
|
|
height: 100%;
|
|
|
|
.header-row {
|
|
width: 100%;
|
|
|
|
.logo-wrapper {
|
|
float: left;
|
|
}
|
|
|
|
.auth-buttons {
|
|
float: right;
|
|
margin-top: 0.4em;
|
|
|
|
.login-button,
|
|
.signup-button {
|
|
padding: 8px 14px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.title {
|
|
--d-logo-height: 2.4em;
|
|
|
|
// min-width acts as a placeholder if the small logo takes a while to load
|
|
// it prevents topic title from shifting after the small logo loads
|
|
// it's set to match the #site-logo height so square small logos don't resize when titles dock
|
|
min-width: var(--d-logo-height);
|
|
display: flex;
|
|
align-items: center;
|
|
height: 100%;
|
|
animation: fadein 0.5s;
|
|
|
|
@include viewport.from(sm) {
|
|
--d-logo-height: 2.667em;
|
|
}
|
|
|
|
@media (prefers-reduced-motion) {
|
|
animation-duration: 0s;
|
|
}
|
|
|
|
a,
|
|
a:visited {
|
|
min-width: 0;
|
|
color: var(--header_primary);
|
|
}
|
|
|
|
&:not(.title--minimized) {
|
|
// allows large logos to be hidden if there are too many other header elements
|
|
// this prioritizes nav elements, especially in cases of high zoom levels
|
|
overflow: hidden;
|
|
}
|
|
}
|
|
|
|
#site-logo {
|
|
height: var(--d-logo-height);
|
|
width: auto;
|
|
max-width: 100%;
|
|
object-fit: contain;
|
|
}
|
|
|
|
.home-logo-wrapper-outlet {
|
|
overflow: hidden;
|
|
}
|
|
|
|
#site-text-logo {
|
|
margin: 0;
|
|
font-size: var(--font-up-1);
|
|
font-weight: bold;
|
|
|
|
@include ellipsis;
|
|
|
|
@include viewport.from(sm) {
|
|
font-size: var(--font-up-3);
|
|
}
|
|
}
|
|
|
|
.d-icon-house {
|
|
font-size: var(--font-up-6);
|
|
}
|
|
|
|
.panel {
|
|
position: relative;
|
|
display: flex;
|
|
flex: 0 0 auto;
|
|
margin-left: auto;
|
|
align-items: center;
|
|
}
|
|
|
|
.hamburger-panel,
|
|
.user-menu,
|
|
.search-menu {
|
|
width: 0; // Flexbox fix for Safari
|
|
}
|
|
|
|
.header-buttons {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-top: 0.2em;
|
|
white-space: nowrap;
|
|
|
|
.auth-buttons {
|
|
display: flex;
|
|
gap: 0.5em;
|
|
}
|
|
}
|
|
|
|
@include viewport.until(sm) {
|
|
.sign-up-button {
|
|
display: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
.header-dropdown-toggle,
|
|
.drop-down,
|
|
.panel-body {
|
|
.flagged-posts,
|
|
.reviewables {
|
|
background: var(--danger);
|
|
min-width: 6px;
|
|
}
|
|
}
|
|
|
|
.d-header-icons {
|
|
display: flex;
|
|
margin: 0 0 0 0.5em;
|
|
list-style: none;
|
|
|
|
.icon {
|
|
box-sizing: content-box;
|
|
appearance: none;
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 2.2857em;
|
|
height: 2.2857em;
|
|
padding: 0.2143em;
|
|
text-decoration: none;
|
|
cursor: pointer;
|
|
outline: none;
|
|
|
|
img.avatar {
|
|
width: 2.1333em;
|
|
height: 2.1333em;
|
|
}
|
|
|
|
.discourse-no-touch &:hover,
|
|
.discourse-no-touch &:focus {
|
|
background-color: var(--d-hover);
|
|
}
|
|
}
|
|
|
|
.drop-down-mode & {
|
|
.active .icon,
|
|
.header-color-scheme-toggle .-expanded {
|
|
position: relative;
|
|
background-color: var(--secondary);
|
|
cursor: default;
|
|
|
|
> .d-icon {
|
|
color: var(--primary-medium);
|
|
}
|
|
}
|
|
}
|
|
|
|
.d-icon {
|
|
width: 100%;
|
|
font-size: var(--font-up-4);
|
|
line-height: var(--line-height-large);
|
|
display: inline-block;
|
|
color: var(--header_primary-low-mid);
|
|
}
|
|
|
|
.notifications {
|
|
position: relative;
|
|
}
|
|
|
|
.header-dropdown-toggle {
|
|
position: relative;
|
|
}
|
|
|
|
.badge-notification {
|
|
border: 2px solid var(--header_background);
|
|
position: absolute;
|
|
z-index: z("base");
|
|
top: -4px;
|
|
min-width: 0.6em;
|
|
left: auto;
|
|
right: -3px;
|
|
|
|
&.with-icon {
|
|
&.new-pms {
|
|
background-color: var(--success);
|
|
}
|
|
|
|
&.new-reviewables {
|
|
background-color: var(--danger);
|
|
}
|
|
|
|
.d-icon {
|
|
color: var(--secondary);
|
|
font-size: var(--font-down-1);
|
|
width: 1em;
|
|
}
|
|
}
|
|
}
|
|
|
|
.unread-notifications {
|
|
background-color: var(--tertiary-med-or-tertiary);
|
|
}
|
|
|
|
.unread-high-priority-notifications {
|
|
left: auto;
|
|
right: 25px;
|
|
}
|
|
}
|
|
|
|
.fk-d-menu.interface-color-selector-content.-expanded {
|
|
margin-top: -0.75em;
|
|
z-index: z("header");
|
|
box-shadow: var(--shadow-dropdown);
|
|
|
|
.fk-d-menu__inner-content {
|
|
border-color: transparent;
|
|
}
|
|
}
|
|
|
|
.header-sidebar-toggle {
|
|
button {
|
|
margin-right: 1em;
|
|
box-sizing: content-box; // matches other header icons
|
|
display: flex;
|
|
justify-content: center;
|
|
width: 2.2857em;
|
|
height: 2.2857em;
|
|
padding: 0.2143em;
|
|
|
|
&:focus,
|
|
.discourse-no-touch & {
|
|
&:hover {
|
|
background-color: var(--primary-low);
|
|
}
|
|
}
|
|
|
|
.d-icon {
|
|
width: 100%;
|
|
font-size: var(--font-up-4);
|
|
line-height: var(--line-height-large);
|
|
display: inline-block;
|
|
color: var(--header_primary-low-mid);
|
|
}
|
|
}
|
|
}
|
|
|
|
// topic info in the header
|
|
.extra-info-wrapper {
|
|
--tag-text-color: var(--header_primary-high);
|
|
flex: 1 0 0;
|
|
display: flex;
|
|
align-items: center;
|
|
height: 100%;
|
|
line-height: var(--line-height-medium);
|
|
padding: 0 1.5em 0 0.5em;
|
|
|
|
// we need to hide overflow in both to truncate the title in a flexbox
|
|
overflow: hidden;
|
|
|
|
.extra-info {
|
|
overflow: hidden;
|
|
width: 100%;
|
|
animation: fadein 0.5s;
|
|
|
|
@media (prefers-reduced-motion) {
|
|
animation-duration: 0s;
|
|
}
|
|
}
|
|
|
|
.title-wrapper {
|
|
display: grid;
|
|
grid-template-areas:
|
|
"title title"
|
|
"categories extra";
|
|
grid-template-columns: auto minmax(2em, 1fr); // min must be as wide as ellipsis
|
|
gap: 0 0.5em;
|
|
|
|
.header-title {
|
|
grid-area: title;
|
|
}
|
|
|
|
.categories-wrapper {
|
|
grid-area: categories;
|
|
}
|
|
|
|
.topic-header-extra {
|
|
grid-area: extra;
|
|
|
|
.archetype-private_message & {
|
|
grid-area: categories;
|
|
}
|
|
}
|
|
}
|
|
|
|
.topic-link {
|
|
color: var(--title-color--header);
|
|
display: block;
|
|
|
|
@include ellipsis;
|
|
}
|
|
|
|
.topic-statuses {
|
|
.d-icon {
|
|
color: var(--header_primary-medium);
|
|
}
|
|
|
|
.d-icon-envelope {
|
|
color: var(--danger);
|
|
}
|
|
}
|
|
|
|
.header-title {
|
|
padding: 0;
|
|
margin: 0;
|
|
width: 100%;
|
|
font-size: var(--font-0);
|
|
|
|
@include viewport.from(sm) {
|
|
font-size: var(--font-up-3);
|
|
}
|
|
}
|
|
|
|
.categories-wrapper {
|
|
display: inline-flex;
|
|
flex: 0 1 auto;
|
|
gap: 0 0.5em;
|
|
|
|
@include ellipsis;
|
|
}
|
|
|
|
.badge-category__wrapper {
|
|
min-width: 2.75em; // min needed for ellipsis
|
|
|
|
@include ellipsis;
|
|
|
|
.badge-category {
|
|
color: var(--header_primary-high);
|
|
}
|
|
}
|
|
|
|
.topic-header-extra {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
max-width: 100%;
|
|
gap: 0.5em;
|
|
|
|
.discourse-tags {
|
|
display: inline;
|
|
|
|
@include ellipsis;
|
|
|
|
.discourse-tag {
|
|
display: inline; // tags need to stay inline in order for them to truncate
|
|
vertical-align: unset;
|
|
}
|
|
}
|
|
|
|
.topic-featured-link {
|
|
align-self: baseline;
|
|
|
|
.d-icon {
|
|
font-size: var(--font-down-2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// PM header participants
|
|
|
|
$avatar-height: 1.641em;
|
|
$mobile-avatar-height: 1.532em;
|
|
|
|
.topic-header-participants {
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: var(--font-down-1);
|
|
|
|
@include ellipsis;
|
|
|
|
&:not(:first-child) {
|
|
margin-left: 5px;
|
|
}
|
|
|
|
.trigger-user-card,
|
|
.trigger-group-card {
|
|
&:not(:last-of-type) {
|
|
margin-right: 5px;
|
|
}
|
|
}
|
|
|
|
.trigger-user-card {
|
|
.icon {
|
|
height: $avatar-height;
|
|
display: inline-block;
|
|
|
|
.mobile-view & {
|
|
height: $mobile-avatar-height;
|
|
}
|
|
|
|
img {
|
|
height: 100%;
|
|
width: auto;
|
|
}
|
|
}
|
|
}
|
|
|
|
.trigger-group-card {
|
|
padding: 0 5px;
|
|
border: 1px solid var(--content-border-color);
|
|
border-radius: 0.25em;
|
|
min-width: 3em;
|
|
|
|
@include ellipsis;
|
|
|
|
.icon {
|
|
display: flex;
|
|
align-items: center;
|
|
height: $avatar-height;
|
|
color: var(--primary-high);
|
|
|
|
.mobile-view & {
|
|
height: $mobile-avatar-height;
|
|
}
|
|
|
|
.d-icon {
|
|
margin-right: 5px;
|
|
}
|
|
}
|
|
|
|
span {
|
|
@include ellipsis;
|
|
}
|
|
}
|
|
|
|
.more-participants {
|
|
color: var(--header_primary-high);
|
|
margin-left: 5px;
|
|
}
|
|
}
|
|
|
|
.d-header-mode {
|
|
.bootstrap-mode {
|
|
color: var(--primary-medium);
|
|
font-size: var(--font-down-1);
|
|
margin-left: 1em;
|
|
padding: 0.15em 0.5em;
|
|
|
|
&:focus {
|
|
background-color: var(--primary-medium);
|
|
color: var(--secondary);
|
|
}
|
|
}
|
|
|
|
.fk-d-button-tooltip .fk-d-tooltip__trigger {
|
|
color: var(--header_primary-high);
|
|
background: transparent;
|
|
}
|
|
}
|
|
|
|
#additional-panel-wrapper {
|
|
position: absolute;
|
|
|
|
// positions are relative to the .d-header .panel div
|
|
top: 100%; // directly underneath .panel
|
|
right: -10px; // 10px to the right of .panel - adjust as needed
|
|
max-height: 80vh;
|
|
border-radius: var(--d-border-radius-large);
|
|
overflow: auto;
|
|
}
|
|
|
|
.mobile-view {
|
|
// Hide header avatar + icons while topic title is visible in mobile header
|
|
.extra-info-wrapper ~ .panel {
|
|
.before-header-panel-outlet,
|
|
.header-buttons,
|
|
.d-header-icons {
|
|
display: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
.impersonation-notice {
|
|
background-color: var(--header_background);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 10px;
|
|
text-align: center;
|
|
|
|
button {
|
|
margin-left: 10px;
|
|
}
|
|
}
|