discourse/app/assets/stylesheets/common/base/new-user.scss
Kris 06f42e0206
DEV: refactor groupNotificationsButton to no longer rely on empty div (#34770)
This undoes an older refactor that introduced an empty div for use with
`in-element` to improve the group inbox loading experience
(https://github.com/discourse/discourse/pull/21930)

The empty span being always present isn't ideal, because this causes
additional space to be included when the `gap` property is used to space
elements within a flex or grid container.

Large space caused by use of `gap` when empty div is present: 
<img width="603" height="130" alt="image"
src="https://github.com/user-attachments/assets/78948e4b-0e7d-4ade-b6ab-b78bcc150fc8"
/>

Additionally, our loading experience is different than it used to be
(compare to the videos in
https://github.com/discourse/discourse/pull/21930... we no longer show
the spinner) — *and* we hide the text for the dropdown button, so
there's much less jankiness to avoid when the notification button is
added:




https://github.com/user-attachments/assets/b25fb53f-725f-4ee0-beaa-64f8aed9d3c1
2025-09-15 09:09:09 -04:00

300 lines
5.1 KiB
SCSS
Vendored

@use "lib/viewport";
@mixin bordered-horizontal-nav($border-width) {
li {
flex: 1 1 auto;
margin: 0;
display: flex;
a {
box-sizing: border-box;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
position: relative;
@include viewport.until(xl) {
font-size: var(--font-0);
}
span {
line-height: normal;
@include ellipsis;
}
}
}
}
@mixin bordered-nav-pills {
width: 100%;
margin: 0;
.d-icon {
font-size: var(--font-down-1);
}
&.main-nav {
@include viewport.until(lg) {
li {
.d-icon {
font-size: var(--font-up-1);
margin: 0;
}
span {
display: none;
}
}
}
.has-sidebar-page & {
@include viewport.until(lg) {
span {
display: none;
}
}
}
}
}
.new-user-wrapper {
.user-navigation {
--user-navigation__border-width: 4px;
border-bottom: 1px solid var(--content-border-color);
.nav-pills {
@include bordered-nav-pills;
@include bordered-horizontal-nav(var(--user-navigation__border-width));
}
}
.user-navigation-primary {
[class*="horizontal-overflow-nav__scroll"] {
font-size: var(--font-up-1);
.d-icon {
margin-top: 0.15em; // minor alignment
}
}
}
[class*="horizontal-overflow-nav__scroll-"] {
--fade-color: var(--d-content-background, var(--secondary));
background-color: var(--d-content-background, var(--secondary));
}
.user-navigation-secondary {
position: relative;
display: flex;
min-width: 0;
gap: 0 0.5em;
font-size: var(--font-down-1);
.select-kit .select-kit-header {
height: 100%;
padding: 0.5em 1em;
}
.select-kit-collection {
font-size: var(--font-up-1);
}
.user-nav-messages-dropdown {
// manage long group names
max-width: 20vw;
min-width: 7em;
.select-kit-selected-name,
.name {
@include ellipsis;
}
.name {
min-width: 0;
}
}
.category-breadcrumb {
width: auto;
margin: calc(var(--nav-space) / 2) 0;
@include viewport.until(xl) {
font-size: var(--font-down-1);
}
> li {
margin: 0;
}
}
.navigation-controls {
margin: calc(var(--nav-space) / 2) 0;
flex-wrap: nowrap;
@include viewport.until(xl) {
font-size: var(--font-down-1);
}
}
.nav-pills {
flex: 1 1 auto;
justify-content: flex-start;
height: 100%;
li {
flex: 1 0 auto;
a {
span {
text-overflow: unset;
}
}
}
}
}
.empty-state {
margin: 1em 0;
}
.solo-preference {
grid-column-start: 1;
grid-column-end: -1;
}
}
.user-preferences-tracking-page {
.user-preferences .form-vertical {
width: 100%;
}
}
.user-preferences__tracking-topics-wrapper {
margin-bottom: 3em;
.control-label {
margin-bottom: 1em;
}
}
.user-preferences__tracking-categories-tags-wrapper {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(16em, 1fr));
gap: 2em;
.control-group {
width: 100%;
min-width: 16em;
}
}
%unread-icon {
font-size: var(--font-down-4);
margin: 0 0.375rem;
color: var(--tertiary);
}
.user-messages-page {
.messages-dropdown-trigger {
.d-icon-d-unread {
@extend %unread-icon;
}
.btn:hover {
.d-icon-d-unread {
color: var(--tertiary);
}
}
.d-icon-angle-down {
margin-right: 0;
}
}
.messages-dropdown-content {
.dropdown-menu__item {
.d-icon-d-unread {
@extend %unread-icon;
}
.btn:hover {
.d-icon-d-unread {
color: var(--tertiary);
}
}
.btn.is-selected {
background: var(--d-selected);
color: var(--primary);
}
}
}
}
@include viewport.until(sm) {
.user-content {
margin-top: 1em;
}
// user messages have some additional controls
// so we need a special layout to acommodate on small screens
.user-messages-page {
.user-navigation-secondary {
display: grid;
grid-template-areas:
"dropdown controls"
"nav-pills nav-pills";
grid-template-columns: 1fr auto;
font-size: var(--font-up-1);
gap: 0.5em;
.category-breadcrumb {
grid-area: dropdown;
}
.horizontal-overflow-nav {
grid-area: nav-pills;
}
.navigation-controls {
grid-area: controls;
font-size: var(--font-down-2);
.btn {
padding: 0.5em 1em;
}
.d-button-label,
.select-kit-header-wrapper .name {
display: none;
}
.d-icon {
margin: 0;
}
}
.user-nav-messages-dropdown {
max-width: unset;
}
.combo-box-header {
font-size: var(--font-0);
}
}
tbody {
border-top-width: 1px;
}
.user-content {
margin: 0;
table {
margin-top: -1px; // align under nav border
}
}
}
}