From 3921278319edcdca68df318561b7c9e928e53b8d Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 22 Aug 2023 09:16:05 -0600 Subject: [PATCH] Add more style helpers --- crates/gpui/playground/src/components.rs | 1 - crates/gpui/playground/src/playground.rs | 2 +- .../playground_macros/src/styleable_helpers.rs | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/gpui/playground/src/components.rs b/crates/gpui/playground/src/components.rs index aa476e2a9dad7de56badcf42602614d1544d76d4..3901968bfcc0c1cd1f75f80419942a27b4180494 100644 --- a/crates/gpui/playground/src/components.rs +++ b/crates/gpui/playground/src/components.rs @@ -7,7 +7,6 @@ use crate::{ }; use gpui::ViewContext; use playground_macros::Element; - use std::{marker::PhantomData, rc::Rc}; struct ButtonHandlers { diff --git a/crates/gpui/playground/src/playground.rs b/crates/gpui/playground/src/playground.rs index ed7aa2995d4fa084c95beacdaa0c2964952d13a7..9bb0b9a8a8f3b8c23cc5effbe88cbbd1cc002e67 100644 --- a/crates/gpui/playground/src/playground.rs +++ b/crates/gpui/playground/src/playground.rs @@ -48,7 +48,7 @@ fn playground(theme: &ThemeColors) -> impl Element { div() .text_color(black()) .h_full() - .w_24() + .w_1_2() .fill(theme.success(0.5)) // .hover() // .fill(theme.error(0.5)) diff --git a/crates/gpui/playground_macros/src/styleable_helpers.rs b/crates/gpui/playground_macros/src/styleable_helpers.rs index 1139d0c0662f5b96c10fb735bb62cc8c01622921..8021154e08a8d029432f54f44476589ebf6f9e48 100644 --- a/crates/gpui/playground_macros/src/styleable_helpers.rs +++ b/crates/gpui/playground_macros/src/styleable_helpers.rs @@ -78,9 +78,25 @@ fn tailwind_lengths() -> Vec<(&'static str, TokenStream2)> { ("48", quote! { rems(12.) }), ("56", quote! { rems(14.) }), ("64", quote! { rems(16.) }), + ("72", quote! { rems(18.) }), + ("80", quote! { rems(20.) }), + ("96", quote! { rems(24.) }), ("auto", quote! { auto() }), ("px", quote! { pixels(1.) }), ("full", quote! { relative(1.) }), + ("1_2", quote! { relative(0.5) }), + ("1_3", quote! { relative(1./3.) }), + ("2_3", quote! { relative(2./3.) }), + ("1_4", quote! { relative(0.25) }), + ("2_4", quote! { relative(0.5) }), + ("3_4", quote! { relative(0.75) }), + ("1_5", quote! { relative(0.2) }), + ("2_5", quote! { relative(0.4) }), + ("3_5", quote! { relative(0.6) }), + ("4_5", quote! { relative(0.8) }), + ("1_6", quote! { relative(1./6.) }), + ("5_6", quote! { relative(5./6.) }), + ("1_12", quote! { relative(1./12.) }), // ("screen_50", quote! { DefiniteLength::Vh(50.0) }), // ("screen_75", quote! { DefiniteLength::Vh(75.0) }), // ("screen", quote! { DefiniteLength::Vh(100.0) }),