[libadwaita/wip/exalm/stylesheet2: 78/103] stylesheet: Split switch styles into a separate file




commit 88f137f3553c8e971c1d7faa963c84daa08e02be
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Apr 9 13:23:45 2021 +0500

    stylesheet: Split switch styles into a separate file

 src/stylesheet/_common.scss         | 63 -------------------------------------
 src/stylesheet/_widgets.scss        |  1 +
 src/stylesheet/meson.build          |  1 +
 src/stylesheet/widgets/_switch.scss | 58 ++++++++++++++++++++++++++++++++++
 4 files changed, 60 insertions(+), 63 deletions(-)
---
diff --git a/src/stylesheet/_common.scss b/src/stylesheet/_common.scss
index db07d32..b97fdcc 100644
--- a/src/stylesheet/_common.scss
+++ b/src/stylesheet/_common.scss
@@ -237,69 +237,6 @@ editablelabel > stack > text {
 }
 
 
-/**********
- * Switch *
- **********/
-switch {
-  // similar to the .scale
-  border: 1px solid $borders_color;
-  border-radius: 14px;
-  color: $fg_color;
-  background-color: $dark_fill;
-  transition: $focus_transition;
-
-  @include focus-ring($offset: 0, $outer: true);
-
-  headerbar & { background-color: darken($dark_fill,8%); } //3504
-
-  &:checked {
-    color: $selected_fg_color;
-    border-color: $switch_borders_color;
-    background-color: $switch_bg_color;
-  }
-
-  &:disabled {
-    color: $insensitive_fg_color;
-    border-color: $borders_color;
-    background-color: $insensitive_bg_color;
-  }
-
-  > slider {
-    @include button(normal);
-
-    margin: -1px;
-    min-width: 24px;
-    min-height: 24px;
-    border: 1px solid;
-    border-color: $borders_color;
-    border-radius: 50%;
-    transition: $button_transition;
-  }
-
-  > image { color: transparent; } /* only show i / o for the accessible theme */
-
-  &:hover > slider {
-    @include button(hover);
-  }
-
-  &:checked > slider { border: 1px solid $switch_borders_color; }
-
-  &:disabled > slider { @include button(insensitive); }
-
-
-  row:selected & {
-    outline-color: $alt_focus_border_color;
-
-    @if $variant == 'light' {
-      box-shadow: none;
-      border-color: $switch_borders_color;
-
-      > slider { &:checked, & { border-color: $switch_borders_color; } }
-    }
-  }
-}
-
-
 /*************************
  * Check and Radio items *
  *************************/
diff --git a/src/stylesheet/_widgets.scss b/src/stylesheet/_widgets.scss
index 554f125..5d86f17 100644
--- a/src/stylesheet/_widgets.scss
+++ b/src/stylesheet/_widgets.scss
@@ -9,5 +9,6 @@
 @import 'widgets/scrolling';
 @import 'widgets/spinner';
 @import 'widgets/spin-button';
+@import 'widgets/switch';
 @import 'widgets/toolbars';
 @import 'widgets/trees';
diff --git a/src/stylesheet/meson.build b/src/stylesheet/meson.build
index 4213eb1..5269f18 100644
--- a/src/stylesheet/meson.build
+++ b/src/stylesheet/meson.build
@@ -31,6 +31,7 @@ if not fs.exists('Adwaita-light.css')
       'widgets/_scrolling.scss',
       'widgets/_spinner.scss',
       'widgets/_spin-button.scss',
+      'widgets/_switch.scss',
       'widgets/_toolbars.scss',
       'widgets/_trees.scss',
     ])
diff --git a/src/stylesheet/widgets/_switch.scss b/src/stylesheet/widgets/_switch.scss
new file mode 100644
index 0000000..6e04957
--- /dev/null
+++ b/src/stylesheet/widgets/_switch.scss
@@ -0,0 +1,58 @@
+switch {
+  // similar to the .scale
+  border: 1px solid $borders_color;
+  border-radius: 14px;
+  color: $fg_color;
+  background-color: $dark_fill;
+  transition: $focus_transition;
+
+  @include focus-ring($offset: 0, $outer: true);
+
+  headerbar & { background-color: darken($dark_fill,8%); } //3504
+
+  &:checked {
+    color: $selected_fg_color;
+    border-color: $switch_borders_color;
+    background-color: $switch_bg_color;
+  }
+
+  &:disabled {
+    color: $insensitive_fg_color;
+    border-color: $borders_color;
+    background-color: $insensitive_bg_color;
+  }
+
+  > slider {
+    @include button(normal);
+
+    margin: -1px;
+    min-width: 24px;
+    min-height: 24px;
+    border: 1px solid;
+    border-color: $borders_color;
+    border-radius: 50%;
+    transition: $button_transition;
+  }
+
+  > image { color: transparent; } /* only show i / o for the accessible theme */
+
+  &:hover > slider {
+    @include button(hover);
+  }
+
+  &:checked > slider { border: 1px solid $switch_borders_color; }
+
+  &:disabled > slider { @include button(insensitive); }
+
+
+  row:selected & {
+    outline-color: $alt_focus_border_color;
+
+    @if $variant == 'light' {
+      box-shadow: none;
+      border-color: $switch_borders_color;
+
+      > slider { &:checked, & { border-color: $switch_borders_color; } }
+    }
+  }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]