//! Shared element constructors and small style helpers. use gpui::{Div, Styled as _, div}; pub use gpui_native_theme::Size; /// A row whose children center on the cross axis. pub fn h_flex() -> Div { div().flex().flex_row().items_center() } /// A column whose children stretch across the cross axis. pub fn v_flex() -> Div { div().flex().flex_col() } /// A component that can be told which size to render at. pub trait Sizable: Sized { /// Sets the size. fn with_size(mut self, size: Size) -> Self { self.apply_size(size); self } /// Applies the size to the component's fields. fn apply_size(&mut self, size: Size); /// Sets `Size::Small`. fn small(self) -> Self where Self: Sized, { self.with_size(Size::Small) } /// Sets `Size::Large`. fn large(self) -> Self where Self: Sized, { self.with_size(Size::Large) } }