diff --git a/crates/gpui/playground/src/playground.rs b/crates/gpui/playground/src/playground.rs index 88e953b8bc953d232668baeed49c48708ad2e423..58b9f9438f5c90a0577dd3d657489560c0ca36a2 100644 --- a/crates/gpui/playground/src/playground.rs +++ b/crates/gpui/playground/src/playground.rs @@ -4,8 +4,9 @@ use crate::{ }; use element::Element; use gpui::{ - geometry::{rect::RectF, vector::vec2f}, + geometry::{pixels, rect::RectF, vector::vec2f}, platform::WindowOptions, + ViewContext, }; use log::LevelFilter; use simplelog::SimpleLogger; @@ -40,7 +41,7 @@ fn main() { center: true, ..Default::default() }, - |_| view(|_| playground(&rose_pine::moon())), + |_| view(|cx| workspace(&rose_pine::moon(), cx)), ); cx.platform().activate(true); }); @@ -58,3 +59,12 @@ fn playground(theme: &ThemeColors) -> impl Element { .child(div().fill(p.pine).child(div().fill(p.love).w_6().h_3())) .child(div().fill(p.gold).child(div().fill(p.iris).w_3().h_3())) } + +fn workspace(theme: &ThemeColors, cx: &mut ViewContext) -> impl Element { + use div::div; + // one line change1! + div() + .full() + .fill(theme.base(0.5)) + .child(div().h(pixels(cx.titlebar_height())).fill(theme.base(0.))) +} diff --git a/crates/gpui/playground/src/style.rs b/crates/gpui/playground/src/style.rs index 0d6a53e29606845e155b8de115296a4bc9373c9b..f01f269aa623b6a2b027663209cc5c25ddd52712 100644 --- a/crates/gpui/playground/src/style.rs +++ b/crates/gpui/playground/src/style.rs @@ -11,8 +11,8 @@ pub use gpui::taffy::style::{ use gpui::{ fonts::TextStyleRefinement, geometry::{ - rect::RectF, AbsoluteLength, DefiniteLength, Edges, EdgesRefinement, Length, Point, - PointRefinement, Size, SizeRefinement, + rect::RectF, relative, AbsoluteLength, DefiniteLength, Edges, EdgesRefinement, Length, + Point, PointRefinement, Size, SizeRefinement, }, taffy, }; @@ -286,6 +286,23 @@ pub trait Styleable { pub trait StyleHelpers: Styleable