Add `shadow_hairline`

Nate Butler created

Change summary

crates/gpui_macros/src/styles.rs                | 17 +++++++++++++++++
crates/ui/src/components/button/split_button.rs |  7 +------
2 files changed, 18 insertions(+), 6 deletions(-)

Detailed changes

crates/gpui_macros/src/styles.rs 🔗

@@ -405,6 +405,23 @@ pub fn box_shadow_style_methods(input: TokenStream) -> TokenStream {
             self
         }
 
+        /// Sets the box shadow of the element.
+        ///
+        /// A hairline shadow is a very thin shadow that is often used
+        /// to create a subtle depth effect under an element.
+        #visibility fn shadow_hairline(mut self) -> Self {
+            use gpui::{BoxShadow, hsla, point, px};
+            use std::vec;
+
+            self.style().box_shadow = Some(vec![BoxShadow {
+                color: hsla(0.0, 0.0, 0.0, 0.16),
+                offset: point(px(0.), px(1.)),
+                blur_radius: px(0.),
+                spread_radius: px(0.),
+            }]);
+            self
+        }
+
         /// Sets the box shadow of the element.
         /// [Docs](https://tailwindcss.com/docs/box-shadow)
         #visibility fn shadow_sm(mut self) -> Self {

crates/ui/src/components/button/split_button.rs 🔗

@@ -41,11 +41,6 @@ impl RenderOnce for SplitButton {
             )
             .child(self.right)
             .bg(ElevationIndex::Surface.on_elevation_bg(cx))
-            .shadow(vec![BoxShadow {
-                color: hsla(0.0, 0.0, 0.0, 0.16),
-                offset: point(px(0.), px(1.)),
-                blur_radius: px(0.),
-                spread_radius: px(0.),
-            }])
+            .shadow_hairline()
     }
 }