discourse/app/assets/stylesheets/common/base/sidebar.scss
Alan Guo Xiang Tan f1cbc23f1e
UX: Add icons to all section links in Sidebar (#18378)
This commit introduces an icon to all links in the sidebar. If an icon has not been configured, we will fall back to a generic "link" icon. As part of this commit, we also standardised the size of each prefix to 20px by 20px and set a fix margin. This is to allow sufficient space for text prefixes and image prefixes to be displayed. 

Tests have been intentionally left out for now as I don't feel like asserting for the icons will bring much value at this point. Time shall prove me wrong.

Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
2022-09-29 12:28:01 +08:00

113 lines
2.7 KiB
SCSS

:root {
--d-sidebar-width: #{$d-sidebar-width};
--d-sidebar-animation-time: 0.25s;
--d-sidebar-animation-ease: ease-in-out;
--d-sidebar-row-height: 30px;
// 1.25rem gets text left-aligned with the hamburger icon
--d-sidebar-row-horizontal-padding: 1.25rem;
--d-sidebar-row-vertical-padding: 0.33rem;
--d-sidebar-row-font-size: var(--font-down-1);
}
.sidebar-row {
box-sizing: border-box;
height: var(--d-sidebar-row-height);
padding: var(--d-sidebar-row-vertical-padding)
var(--d-sidebar-row-horizontal-padding);
align-items: center;
font-size: var(--d-sidebar-row-font-size);
}
.sidebar-wrapper {
display: flex;
--d-sidebar-highlight-color: var(--primary-low);
background-color: var(--primary-50);
grid-area: sidebar;
position: sticky;
top: var(--header-offset);
.footer-nav-ipad & {
top: calc(var(--header-offset) + var(--footer-nav-height));
}
height: calc(100vh - var(--header-offset, 0));
align-self: start;
overflow-y: auto;
.sidebar-container {
display: flex;
flex-direction: column;
box-sizing: border-box;
height: 100%;
width: 100%;
padding: 0;
overflow-x: hidden;
// allows sidebar to scroll to the bottom when the composer is open
height: calc(100% - var(--composer-height, 0));
}
.sidebar-sections {
display: flex;
flex-direction: column;
box-sizing: border-box;
flex: 1;
padding: 1.5em 0 1em;
overflow-x: hidden;
overflow-y: overlay;
// custom scrollbar styling
--scrollbarBg: transparent;
--scrollbarThumbBg: var(--primary-low);
--scrollbarWidth: 0.5em;
scrollbar-color: transparent var(--scrollbarBg);
transition: scrollbar-color 0.25s ease-in-out;
transition-delay: 0.5s;
&::-webkit-scrollbar {
width: var(--scrollbarWidth);
}
&::-webkit-scrollbar-thumb {
background-color: transparent;
border-radius: calc(var(--scrollbarWidth) / 2);
}
&::-webkit-scrollbar-track {
background-color: transparent;
}
&:hover {
scrollbar-color: var(--scrollbarThumbBg) var(--scrollbarBg);
&::-webkit-scrollbar-thumb {
background-color: var(--scrollbarThumbBg);
}
transition-delay: 0s;
}
}
}
.sidebar-hamburger-dropdown {
.discourse-no-touch & {
.sidebar-section-wrapper .sidebar-section-header-wrapper:hover,
.sidebar-section-wrapper .sidebar-section-header-wrapper:focus-within {
background: transparent;
}
}
.sidebar-footer-wrapper {
margin-top: 1em;
.sidebar-footer-container {
background: var(--secondary);
&:before {
background: linear-gradient(
to bottom,
transparent,
rgba(var(--secondary-rgb), 1)
);
}
}
}
}