UX: new sidebar styling (#29119)

This commit is contained in:
chapoi 2024-10-08 11:28:36 +02:00 committed by GitHub
parent a7a9148b1e
commit 0ba7a7ecab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 38 additions and 20 deletions

View File

@ -1,5 +1,5 @@
:root { :root {
--d-sidebar-section-link-prefix-margin-right: 0.35rem; --d-sidebar-section-link-prefix-margin-right: 0.75em;
--d-sidebar-section-link-prefix-width: 1.35rem; --d-sidebar-section-link-prefix-width: 1.35rem;
--d-sidebar-section-link-icon-size: 0.8em; --d-sidebar-section-link-icon-size: 0.8em;
} }
@ -9,6 +9,12 @@
align-items: center; align-items: center;
position: relative; position: relative;
&[data-list-item-name="all-categories"],
&[data-list-item-name="all-tags"],
&[data-list-item-name="configure-default-navigation-menu-tags"] {
font-size: var(--font-down-1-rem);
}
.sidebar-section-link { .sidebar-section-link {
display: inline-flex; display: inline-flex;
width: 100%; width: 100%;
@ -26,14 +32,17 @@
} }
&.active { &.active {
color: var(--d-sidebar-highlight-color); background: var(--d-selected);
background: var(--d-sidebar-highlight-background); font-weight: bold;
.sidebar-section-link-prefix { .sidebar-section-link-prefix {
&.icon { &.icon {
color: var(--d-sidebar-highlight-color); color: var(--d-sidebar-highlight-color);
} }
} }
.sidebar-section-link-hover:hover .sidebar-section-hover-button {
background-color: var(--d-selected);
}
} }
.sidebar-section-link-content-badge { .sidebar-section-link-content-badge {

View File

@ -1,5 +1,14 @@
.sidebar-section-wrapper { .sidebar-section-wrapper {
.discourse-no-touch & { .discourse-no-touch & {
padding-block: 0.35rem;
border-bottom: 1px solid var(--secondary-very-high);
&:first-child {
padding-top: 0;
}
&[data-section-name="user-threads"] {
padding-bottom: 0;
}
&:hover { &:hover {
.sidebar-section-header-wrapper { .sidebar-section-header-wrapper {
.btn.dropdown-select-box-header, .btn.dropdown-select-box-header,
@ -15,7 +24,6 @@
.discourse-no-touch & { .discourse-no-touch & {
&:hover { &:hover {
background: var(--d-sidebar-highlight-background);
.d-icon-globe { .d-icon-globe {
color: var(--d-sidebar-highlight-color); color: var(--d-sidebar-highlight-color);
} }
@ -74,16 +82,20 @@
.sidebar-section-header { .sidebar-section-header {
flex: 1 1 auto; flex: 1 1 auto;
color: var(--d-sidebar-header-color);
align-items: center; align-items: center;
min-width: 0; min-width: 0;
padding: 0; padding: 0;
font-size: var(--font-down-2-rem);
color: var(--primary-medium);
font-weight: bold;
text-transform: uppercase;
letter-spacing: 0.05em;
&.sidebar-section-header-collapsable { &.sidebar-section-header-collapsable {
justify-content: flex-start; justify-content: flex-start;
&:hover { &:hover {
color: var(--primary); color: var(--primary-medium);
} }
&:focus { &:focus {
@ -115,8 +127,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
svg { .d-icon {
font-size: var(--font-down-1);
color: var(--d-sidebar-header-icon-color); color: var(--d-sidebar-header-icon-color);
} }
} }
@ -147,7 +158,6 @@
} }
.sidebar-section-content { .sidebar-section-content {
padding-bottom: 0.875em;
margin: 0; margin: 0;
hr { hr {
margin: 0em 1.5em; margin: 0em 1.5em;

View File

@ -6,9 +6,9 @@
--d-sidebar-animation-time: 0.25s; --d-sidebar-animation-time: 0.25s;
--d-sidebar-animation-ease: ease-in-out; --d-sidebar-animation-ease: ease-in-out;
// 1.25rem gets text left-aligned with the hamburger icon // 1.25rem gets text left-aligned with the hamburger icon
--d-sidebar-row-horizontal-padding: 1.25rem; --d-sidebar-row-horizontal-padding: 1rem;
// ems so height is variable along with font size // ems so height is variable along with font size
--d-sidebar-row-height: 2.1em; --d-sidebar-row-height: 2.2em;
--d-sidebar-background: var(--secondary); --d-sidebar-background: var(--secondary);
--d-sidebar-admin-background: var(--primary-very-low); --d-sidebar-admin-background: var(--primary-very-low);
@ -81,10 +81,14 @@
flex-direction: column; flex-direction: column;
box-sizing: border-box; box-sizing: border-box;
flex: 1; flex: 1;
padding: 1.35em 0 1em; padding: 1.5rem 1rem 1rem;
overflow-x: hidden; overflow-x: hidden;
overflow-y: overlay; overflow-y: overlay;
> .sidebar-section-wrapper:last-child {
border-bottom: 0;
}
// custom scrollbar styling // custom scrollbar styling
--scrollbarBg: transparent; --scrollbarBg: transparent;
--scrollbarThumbBg: var(--primary-low); --scrollbarThumbBg: var(--primary-low);

View File

@ -58,13 +58,8 @@
//sidebar //sidebar
#sidebar-section-content-user-threads { #sidebar-section-content-user-threads {
padding-bottom: 0.5rem; padding-bottom: 0.35em;
.sidebar-section-link-wrapper:hover {
.sidebar-section-link-prefix {
color: var(--primary-very-high);
}
}
.sidebar-section-link-content-text { .sidebar-section-link-content-text {
color: var(--d-sidebar-header-color); color: var(--d-sidebar-link-color);
} }
} }

View File

@ -23,7 +23,7 @@ RSpec.describe "Sidebar navigation menu", type: :system do
expect(sidebar_page.channels_section).to have_css( expect(sidebar_page.channels_section).to have_css(
".sidebar-section-header-text", ".sidebar-section-header-text",
text: I18n.t("js.chat.chat_channels"), text: I18n.t("js.chat.chat_channels").upcase,
) )
end end