discourse/app/assets/stylesheets/common/components/navs.scss
Penar Musaraj a4e6675e00
DEV: Add --d-selected-text-color variable (#39495)
Allows easier overrides for `d-selected` in themes, especially when
using bright colors and wanting the selected text to be different from
the primary text color.

Example: 

<img width="1526" height="927" alt="image"
src="https://github.com/user-attachments/assets/3a6c8f9f-ea08-4c29-a0a1-362296e76041"
/>

Without this change in core, we'd need to target each place where
`d-selected` is used. With this change, the theme only needs to override
`--d-selected-text-color`.
2026-04-23 13:06:24 -04:00

128 lines
2.3 KiB
SCSS
Vendored

@use "lib/viewport";
// --------------------------------------------------
// Navigation menus
// --------------------------------------------------
// Base
// --------------------------------------------------
%nav {
margin-left: 0;
list-style: none;
li a {
display: block;
text-decoration: none;
}
}
// Pill nav
// --------------------------------------------------
.nav-pills {
@extend %nav;
display: flex;
flex-direction: row;
align-items: stretch;
gap: 0.5em;
> li {
display: flex;
> a,
button {
position: relative;
border: 0;
border-radius: var(--d-nav-pill-border-radius);
padding: 0.65em 0.75em;
color: var(--d-nav-color);
line-height: var(--line-height-small);
box-sizing: border-box;
min-height: 30px;
display: flex;
align-items: center;
background-color: var(--d-nav-bg-color);
transition: var(--d-button-transition);
white-space: nowrap;
@include viewport.between(sm, lg) {
font-size: var(--font-0);
padding: var(--space-2) var(--space-3);
}
.d-icon {
margin-right: 5px;
color: var(--primary-high);
transition: color 0.2s;
}
&:hover {
@include nav-hover;
}
}
a.active,
button.active {
@include nav-active;
}
}
}
// Stacked nav
// --------------------------------------------------
.nav-stacked {
@extend %nav;
padding: 0;
li {
border-bottom: 1px solid var(--content-border-color);
&:last-of-type {
border-bottom: 0;
}
&.indent {
padding-left: 15px;
}
}
a {
margin: 0;
padding: 0.75em;
line-height: var(--line-height-small);
cursor: pointer;
color: var(--primary);
@include ellipsis;
&:hover {
background: var(--d-sidebar-highlight-background);
}
&.active {
color: var(--d-selected-text-color);
background-color: var(--d-selected);
font-weight: bold;
font-weight: var(--d-sidebar-active-font-weight);
}
}
.count {
font-size: var(--font-down-1);
}
.glyph {
font-size: var(--font-down-1);
width: 1.25em;
text-align: center;
margin-right: 0.25em;
line-height: var(--line-height-large);
}
}
.user-navigation .nav-pills > li {
a,
button {
border-radius: 0;
}
}