A platform for community discussion. Free, open, simple.
REFACTOR: merge mobile and desktop menu-panel CSS into common (#33350)
Krisb92262d56b59
diff --git a/app/assets/stylesheets/common/base/menu-panel.scss b/app/assets/stylesheets/common/base/menu-panel.scssindex 7de28188b6f..05350d88436 100644--- a/app/assets/stylesheets/common/base/menu-panel.scss+++ b/app/assets/stylesheets/common/base/menu-panel.scss@@ -35,6 +35,13 @@right: -10px; // 10px to the right of .panel - adjust as neededmax-height: calc(100dvh - var(--header-offset) - 1em);border-radius: var(--d-border-radius);++ .panel-body {+ // improves usability on high zoom levels+ max-width: calc(100vw - 2em);+ }++ @include float-down;}.menu-panel {@@ -197,6 +204,9 @@width: 100%;display: flex;flex-direction: column;++ // 2em padding very useful for iOS Safari's overlayed bottom nav+ // padding-bottom: calc(env(safe-area-inset-bottom) + 2em);}.panel-body-bottom {@@ -250,9 +260,13 @@.user-menu.revamped {--user-menu-border-width: 1px;right: 0;- width: 320px;padding: 0;border-top-right-radius: 0;+ width: unset;++ @include viewport.until(sm) {+ width: 320px;+ }.panel-body-bottom {flex: 0;@@ -277,6 +291,10 @@border-radius: 0;padding: 0.875em 1em 0.875em 0.875em;+ @include viewport.until(sm) {+ padding: 1.2em 1.4em;+ }+@media screen and (height <= 400px) {// helps with 400% zoom levelfont-size: var(--font-down-1);@@ -322,6 +340,12 @@.panel-body-contents {display: flex;flex-direction: row-reverse;++ @include viewport.until(sm) {+ .quick-access-panel li {+ padding-block: 0.15em;+ }+ }}.quick-access-panel {@@ -410,6 +434,84 @@.panel-body {overflow-y: auto;}++ @include viewport.until(sm) {+ .sidebar-section-wrapper {+ margin-bottom: 1.2em;+ }+ }++ @include viewport.from(sm) {+ // sidebar-hamburger hybrid+ .revamped {+ --d-sidebar-row-height: 1.875rem;+ width: 22.5rem;++ .panel-body-content {+ width: 100%;+ min-width: 0; // prevent content blowing out width+ }++ .sidebar-section-wrapper {+ .sidebar-section-header-button {+ opacity: 1;+ }++ .sidebar-section-link.active {+ font-weight: normal;+ background: var(--d-hover);+ }++ .sidebar-section-header-wrapper .select-kit .btn:hover {+ background: transparent;+ }++ &.sidebar-section {+ padding-top: 0.5em;++ .sidebar-section-header-wrapper {+ margin: 0 0 0.5em;+ padding-bottom: 0.25em;+ }++ .sidebar-section-content {+ display: grid;+ grid-template-columns: 1fr 1fr;++ li {+ min-width: 0;+ }+ }+ }+ }++ .sidebar-section-link-wrapper+ .sidebar-section-link-hover:hover+ .sidebar-section-hover-button {+ background: transparent;+ }++ .sidebar-footer-wrapper {+ padding: 0;+ margin-top: 1em;++ .sidebar-footer-container {+ padding: 0;+ border: none;+ background: var(--secondary);++ &::before {+ top: -1.5em;+ background: linear-gradient(+ to bottom,+ transparent,+ rgb(var(--secondary-rgb), 1)+ );+ }+ }+ }+ }+ }}.menu-links.columned {@@ -702,3 +804,20 @@min-height: 100%;}}++.sidebar-section-header {+ .sidebar-section-header-global-indicator {+ .d-icon {+ color: var(--d-sidebar-header-icon-color);+ }+ }+}++.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;+ }+ }+}diff --git a/app/assets/stylesheets/common/base/sidebar-section.scss b/app/assets/stylesheets/common/base/sidebar-section.scssindex 39acffaf600..83994baf7ce 100644--- a/app/assets/stylesheets/common/base/sidebar-section.scss+++ b/app/assets/stylesheets/common/base/sidebar-section.scss@@ -2,14 +2,6 @@.sidebar-section-header-wrapper {display: flex;- .discourse-no-touch & {- &:hover {- .d-icon-globe {- color: var(--d-sidebar-highlight-color);- }- }- }-&:focus-within {background: var(--d-sidebar-highlight-background);}diff --git a/app/assets/stylesheets/desktop/_index.scss b/app/assets/stylesheets/desktop/_index.scssindex 66d3a4daf00..c0a81e5e217 100644--- a/app/assets/stylesheets/desktop/_index.scss+++ b/app/assets/stylesheets/desktop/_index.scss@@ -1,7 +1,6 @@@import "category-list";@import "latest-topic-list";@import "login-signup-page";-@import "menu-panel";@import "modal";@import "post-action-feedback";@import "topic";diff --git a/app/assets/stylesheets/desktop/menu-panel.scss b/app/assets/stylesheets/desktop/menu-panel.scssdeleted file mode 100644index b40771e2eaa..00000000000--- a/app/assets/stylesheets/desktop/menu-panel.scss+++ /dev/null@@ -1,106 +0,0 @@-.menu-panel {- &.user-menu.revamped {- width: unset;- }-- &.drop-down {- .panel-body {- max-width: calc(100vw - 2em);- }- }-}--.user-menu.revamped.menu-panel.drop-down {- @include float-down;-}--// Sidebar-hamburger hybrid-.hamburger-panel .revamped {- --d-sidebar-highlight-background: var(--d-hover);- --d-sidebar-row-height: 30px;-- // 1.25rem gets text left-aligned with the hamburger icon- --d-sidebar-row-horizontal-padding: 0.66rem;- width: 360px;-- .panel-body-content {- width: 100%;- min-width: 0; // prevent content blowing out width- }-- .sidebar-section-wrapper {- .sidebar-section-header-button {- opacity: 1;- }-- .sidebar-section-link.active {- font-weight: normal;- background: var(--d-hover);- }-- .sidebar-section-header-wrapper .select-kit .btn:hover {- background: transparent;- }-- &.sidebar-section {- padding-top: 0.5em;-- .sidebar-section-header-wrapper {- margin: 0 0 0.5em;- padding-bottom: 0.25em;-- .d-icon-globe {- color: var(--primary-medium);- }- }-- .sidebar-section-content {- display: grid;- grid-template-columns: 1fr 1fr;-- li {- min-width: 0;- }- }- }-- .sidebar-section-message {- padding: 0;- }- }-- .sidebar-section-link-wrapper- .sidebar-section-link-hover:hover- .sidebar-section-hover-button {- background: transparent;- }-- .sidebar-footer-wrapper {- padding: 0;- margin-top: 1em;-- .sidebar-footer-container {- padding: 0;- border: none;- background: var(--secondary);-- &::before {- top: -1.5em;- background: linear-gradient(- to bottom,- transparent,- rgb(var(--secondary-rgb), 1)- );- }- }- }-}--.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;- }- }-}diff --git a/app/assets/stylesheets/mobile/_index.scss b/app/assets/stylesheets/mobile/_index.scssindex d351da9c42c..f2d426806b9 100644--- a/app/assets/stylesheets/mobile/_index.scss+++ b/app/assets/stylesheets/mobile/_index.scss@@ -1,5 +1,4 @@@import "login-signup-page";-@import "menu-panel";@import "modal";@import "post-action-feedback";@import "push-notifications-mobile";diff --git a/app/assets/stylesheets/mobile/menu-panel.scss b/app/assets/stylesheets/mobile/menu-panel.scssdeleted file mode 100644index 7f5a607b4a1..00000000000--- a/app/assets/stylesheets/mobile/menu-panel.scss+++ /dev/null@@ -1,75 +0,0 @@-.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%;-- .quick-access-panel li {- padding-block: 0.15em;- }- }-}--.tabs-list .btn {- .user-menu.revamped & {- padding: 1.2em 1.4em;- }-}--.hamburger-panel .revamped {- --d-sidebar-row-horizontal-padding: 1rem;- --d-sidebar-highlight-backgrond: var(--primary-low);- box-sizing: border-box;-- .panel-body-contents {- .sidebar-hamburger-dropdown {- display: flex;- flex-direction: column;- padding-top: 0.5em;- flex: 1 1 auto;- }- }-- .sidebar-row {- &.sidebar-section-message-wrapper {- padding-top: 0;- padding-bottom: 0.25em;- }- }-- .sidebar-section-wrapper {- margin-bottom: 1.2em;- }-- .sidebar-footer-wrapper {- margin-top: 0;- }-- .sidebar-footer-container {- &::before {- background: linear-gradient(- to bottom,- rgb(var(--primary-very-low-rgb), 0),- rgb(var(--primary-very-low-rgb), 1)- );- }- }-- .sidebar-sections {- display: flex;- flex-direction: column;- box-sizing: border-box;- flex: 1 1 auto;- }-- .sidebar-section-content {- padding-bottom: 0;- }-- .sidebar-section-header-wrapper {- .d-icon-globe {- color: var(--primary-medium);- font-size: var(--font-down-1);- }- }-}