Move UI out of storybook2
and into ui2
This commit is contained in:
parent
1cf5cdbeca
commit
bcad2f4e9e
26 changed files with 51 additions and 78 deletions
31
crates/ui2/src/elements/stack.rs
Normal file
31
crates/ui2/src/elements/stack.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
use gpui3::{div, Div};
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
pub trait Stack: StyleHelpers {
|
||||
/// Horizontally stacks elements.
|
||||
fn h_stack(self) -> Self {
|
||||
self.flex().flex_row().items_center()
|
||||
}
|
||||
|
||||
/// Vertically stacks elements.
|
||||
fn v_stack(self) -> Self {
|
||||
self.flex().flex_col()
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> Stack for Div<S> {}
|
||||
|
||||
/// Horizontally stacks elements.
|
||||
///
|
||||
/// Sets `flex()`, `flex_row()`, `items_center()`
|
||||
pub fn h_stack<S: 'static>() -> Div<S> {
|
||||
div().h_stack()
|
||||
}
|
||||
|
||||
/// Vertically stacks elements.
|
||||
///
|
||||
/// Sets `flex()`, `flex_col()`
|
||||
pub fn v_stack<S: 'static>() -> Div<S> {
|
||||
div().v_stack()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue