This PR mainlines the current state of new GPUI2-based UI from the `gpui2-ui` branch. Release Notes: - N/A --------- Co-authored-by: Nate Butler <iamnbutler@gmail.com> Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com> Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com> Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Co-authored-by: Nate <nate@zed.dev> Co-authored-by: Mikayla <mikayla@zed.dev>
32 lines
629 B
Rust
32 lines
629 B
Rust
use gpui2::elements::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<V> Stack for Div<V> {}
|
|
|
|
/// Horizontally stacks elements.
|
|
///
|
|
/// Sets `flex()`, `flex_row()`, `items_center()`
|
|
pub fn h_stack<V: 'static>() -> Div<V> {
|
|
div().h_stack()
|
|
}
|
|
|
|
/// Vertically stacks elements.
|
|
///
|
|
/// Sets `flex()`, `flex_col()`
|
|
pub fn v_stack<V: 'static>() -> Div<V> {
|
|
div().v_stack()
|
|
}
|