mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 22:09:35 +08:00
a24bcceb19
* UX: account for sidebar in breakpoint mixin * default to false
109 lines
2.6 KiB
SCSS
109 lines
2.6 KiB
SCSS
:root {
|
|
--d-sidebar-width: #{$d-sidebar-width};
|
|
--d-sidebar-animation-time: 0.25s;
|
|
--d-sidebar-animation-ease: ease-in-out;
|
|
}
|
|
|
|
.header-sidebar-toggle {
|
|
--toggle-padding: 0.5em;
|
|
margin-right: 0.75em;
|
|
// extending the toggle beyond the page when space allows
|
|
// for better logo alignment with content
|
|
@media screen and (min-width: 1380px) {
|
|
margin-left: -3.5em;
|
|
}
|
|
|
|
// align on icon, because button is transparent
|
|
@media screen and (max-width: 1480px) {
|
|
margin-left: calc(var(--toggle-padding) * -1.3);
|
|
}
|
|
|
|
// prevents toggle overflow on smaller screens
|
|
@media screen and (max-width: 1379px) {
|
|
:not(.mobile-view) .has-sidebar-page & {
|
|
margin-left: initial;
|
|
}
|
|
}
|
|
|
|
transition: margin var(--d-sidebar-animation-speed)
|
|
var(--d-sidebar-animation-ease);
|
|
|
|
button {
|
|
position: relative;
|
|
font-size: var(--font-up-2);
|
|
padding: var(--toggle-padding);
|
|
|
|
.discourse-no-touch & {
|
|
&:hover {
|
|
background: var(--primary-low);
|
|
.d-icon {
|
|
color: var(--primary-medium);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#main-outlet-wrapper {
|
|
.sidebar-wrapper {
|
|
grid-area: sidebar;
|
|
position: sticky;
|
|
top: var(--header-offset);
|
|
height: calc(100vh - var(--header-offset));
|
|
align-self: start;
|
|
overflow-y: auto;
|
|
background-color: var(--primary-very-low);
|
|
.discourse-touch &,
|
|
&:hover {
|
|
.sidebar-section-header-caret {
|
|
opacity: 1;
|
|
transition-delay: 0s;
|
|
}
|
|
}
|
|
}
|
|
|
|
.sidebar-container {
|
|
box-sizing: border-box;
|
|
height: 100%;
|
|
width: var(--d-sidebar-width);
|
|
padding: 1em 0;
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
|
|
// custom scrollbar styling
|
|
--scrollbarBg: transparent;
|
|
--scrollbarThumbBg: var(--primary-low);
|
|
--scrollbarWidth: 1.2em;
|
|
|
|
scrollbar-color: transparent var(--scrollbarBg);
|
|
transition: scrollbar-color 0.25s ease-in-out;
|
|
transition-delay: 0.5s;
|
|
|
|
&::-webkit-scrollbar-thumb {
|
|
background-color: transparent;
|
|
border-radius: calc(var(--scrollbarWidth) / 2);
|
|
border: calc(var(--scrollbarWidth) / 4) solid var(--primary-very-low);
|
|
}
|
|
&:hover {
|
|
scrollbar-color: var(--scrollbarThumbBg) var(--scrollbarBg);
|
|
&::-webkit-scrollbar-thumb {
|
|
background-color: var(--scrollbarThumbBg);
|
|
}
|
|
transition-delay: 0s;
|
|
}
|
|
&::-webkit-scrollbar {
|
|
width: var(--scrollbarWidth);
|
|
}
|
|
}
|
|
|
|
.sidebar-scroll-wrap {
|
|
// limit the wrapper width, so when the scrollbar is added the content doesn't shift
|
|
max-width: calc(var(--d-sidebar-width) - var(--scrollbarWidth));
|
|
}
|
|
|
|
.sidebar-toggle {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
}
|
|
}
|