Skip to content

A platform for community discussion. Free, open, simple.

DEV: move desktop sidebar-section CSS to common, remove desktop css index (#40803)

Krisb1399d6a6f4f
diff --git a/app/assets/stylesheets/common/base/sidebar-section.scss b/app/assets/stylesheets/common/base/sidebar-section.scss
index 3350e75982d..94776812615 100644
--- a/app/assets/stylesheets/common/base/sidebar-section.scss
+++ b/app/assets/stylesheets/common/base/sidebar-section.scss
@@ -1,8 +1,27 @@
+@use "lib/viewport";
+
.sidebar-section-wrapper {
+ @include viewport.from(sm) {
+ padding-block: var(--space-1);
+ border-bottom: 1px solid var(--d-sidebar-section-border-color);
+
+ &:first-child {
+ padding-top: 0;
+ }
+
+ &[data-section-name="user-threads"] {
+ padding-bottom: 0;
+ }
+ }
+
.sidebar-section-header-wrapper {
display: flex;
border-radius: var(--d-border-radius);
+ @include viewport.from(sm) {
+ padding-right: var(--d-sidebar-row-horizontal-padding);
+ }
+
&:focus-within {
background: var(--d-sidebar-highlight-background);
}
@@ -51,6 +70,15 @@
}
}
+ &:hover {
+ .sidebar-section-header-wrapper {
+ .btn.dropdown-select-box-header,
+ .sidebar-section-header-button {
+ opacity: 1;
+ }
+ }
+ }
+
.sidebar-section-header {
flex: 1 1 auto;
align-items: center;
diff --git a/app/assets/stylesheets/desktop.scss b/app/assets/stylesheets/desktop.scss
index c6426b3a5a1..566f6f39081 100644
--- a/app/assets/stylesheets/desktop.scss
+++ b/app/assets/stylesheets/desktop.scss
@@ -1,2 +1,3 @@
-// Import all component-specific files
-@import "desktop/components/_index";
+// This file intentionally left blank — the stylesheet compiler generates `@import "desktop"`
+// Plugins and themes can still add desktop styles for import
+// Instead of authoring desktop-specific styles, use media queries in the common stylesheets
diff --git a/app/assets/stylesheets/desktop/components/_index.scss b/app/assets/stylesheets/desktop/components/_index.scss
deleted file mode 100644
index 0369da7c994..00000000000
--- a/app/assets/stylesheets/desktop/components/_index.scss
+++ /dev/null
@@ -1 +0,0 @@
-@import "sidebar/sidebar-section";
diff --git a/app/assets/stylesheets/desktop/components/sidebar/sidebar-section.scss b/app/assets/stylesheets/desktop/components/sidebar/sidebar-section.scss
deleted file mode 100644
index d3d02147686..00000000000
--- a/app/assets/stylesheets/desktop/components/sidebar/sidebar-section.scss
+++ /dev/null
@@ -1,25 +0,0 @@
-.sidebar-section-wrapper {
- padding-block: var(--space-1);
- border-bottom: 1px solid var(--d-sidebar-section-border-color);
-
- &:first-child {
- padding-top: 0;
- }
-
- &[data-section-name="user-threads"] {
- padding-bottom: 0;
- }
-
- &:hover {
- .sidebar-section-header-wrapper {
- .btn.dropdown-select-box-header,
- .sidebar-section-header-button {
- opacity: 1;
- }
- }
- }
-
- .sidebar-section-header-wrapper {
- padding-right: var(--d-sidebar-row-horizontal-padding);
- }
-}
diff --git a/spec/lib/stylesheet/compiler_spec.rb b/spec/lib/stylesheet/compiler_spec.rb
index 425b8238756..23b07c357d1 100644
--- a/spec/lib/stylesheet/compiler_spec.rb
+++ b/spec/lib/stylesheet/compiler_spec.rb
@@ -9,8 +9,8 @@ RSpec.describe Stylesheet::Compiler do
path = File.basename(path, ".scss")
- # mobile.scss and mobile_rtl.scss are intentionally empty stubs
- next if path.start_with?("mobile")
+ # mobile and desktop scss files are intentionally empty stubs
+ next if path.start_with?("mobile", "desktop")
it "can compile '#{path}' css" do
css, _map = Stylesheet::Compiler.compile_asset(path)