discourse/app/assets/stylesheets/mobile/menu-panel.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

128 lines
2.5 KiB
SCSS

.hamburger-panel .menu-panel.slide-in {
left: 0;
.panel-body {
display: block;
}
.panel-body-contents {
max-height: unset;
}
}
.header-cloak {
height: 100%;
width: 100%;
position: fixed;
background-color: black;
--opacity: 0.5;
opacity: var(--opacity);
top: 0;
left: 0;
display: none;
touch-action: pan-y pinch-zoom;
@media (prefers-reduced-motion: no-preference) {
&.animate {
transition: opacity 0.1s linear;
}
}
}
.menu-panel.slide-in {
transform: translateX(var(--offset));
@media (prefers-reduced-motion: no-preference) {
&.animate {
transition: transform 0.1s linear;
}
}
&.moving,
&.animate {
// PERF: only render first 20 items in a list to allow for smooth
// pan events
li:nth-child(n + 20) {
display: none;
}
}
}
.user-menu .quick-access-panel.quick-access-profile li:not(.show-all) {
border-bottom: 1px solid var(--primary-low);
a,
button {
// accounts for menu "ears" 4px + border 1px
padding: 0.75em calc(0.5em + 4px + 1px);
margin: 0.25em;
@media screen and (max-height: 500px) {
// reduce padding to avoid scroll
padding-top: 0.25em;
padding-bottom: 0.25em;
}
}
}
.panel-body-contents {
// 2em padding very useful for iOS Safari's overlayed bottom nav
// padding-bottom: calc(env(safe-area-inset-bottom) + 2em);
.user-menu.revamped & {
height: 100%;
}
}
.hamburger-panel .revamped {
--d-sidebar-row-horizontal-padding: 1rem;
--d-sidebar-highlight-color: var(--primary-low);
--d-sidebar-row-font-size: var(--font-0);
--d-sidebar-row-height: 32px;
--d-sidebar-section-header-text-font-size: var(--font-0);
box-sizing: border-box;
padding: 0;
.panel-body-contents {
.sidebar-hamburger-dropdown {
display: flex;
flex-direction: column;
padding-top: 0.5em;
}
}
.sidebar-row {
&.sidebar-section-message-wrapper {
padding-top: 0;
padding-bottom: 0.25em;
}
.sidebar-section-message {
padding: 0;
}
}
.sidebar-section-wrapper {
margin-bottom: 1.2em;
}
.sidebar-footer-wrapper {
margin-top: 0;
}
.sidebar-footer-container {
&:before {
background: linear-gradient(
to bottom,
rgba(var(--primary-very-low-rgb), 0),
rgba(var(--primary-very-low-rgb), 1)
);
}
}
.sidebar-sections {
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.sidebar-section-content {
padding-bottom: 0;
}
}