This PR renames the `h_stack` and `v_stack` to `h_flex` and `v_flex`, respectively. We were previously using `h_stack` and `v_stack` to match SwiftUI, but `h_flex` and `v_flex` fit better with the web/flexbox terminology that the rest of GPUI uses. Additionally, we were already calling the utility functions used to implement `h_stack` and `v_stack` by the new names. Release Notes: - N/A
48 lines
1.7 KiB
Rust
48 lines
1.7 KiB
Rust
use gpui::{Render, ViewContext};
|
|
use story::Story;
|
|
|
|
use crate::prelude::*;
|
|
use crate::{h_flex, Checkbox};
|
|
|
|
pub struct CheckboxStory;
|
|
|
|
impl Render for CheckboxStory {
|
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
|
Story::container()
|
|
.child(Story::title_for::<Checkbox>())
|
|
.child(Story::label("Default"))
|
|
.child(
|
|
h_flex()
|
|
.p_2()
|
|
.gap_2()
|
|
.rounded_md()
|
|
.border()
|
|
.border_color(cx.theme().colors().border)
|
|
.child(Checkbox::new("checkbox-enabled", Selection::Unselected))
|
|
.child(Checkbox::new(
|
|
"checkbox-intermediate",
|
|
Selection::Indeterminate,
|
|
))
|
|
.child(Checkbox::new("checkbox-selected", Selection::Selected)),
|
|
)
|
|
.child(Story::label("Disabled"))
|
|
.child(
|
|
h_flex()
|
|
.p_2()
|
|
.gap_2()
|
|
.rounded_md()
|
|
.border()
|
|
.border_color(cx.theme().colors().border)
|
|
.child(Checkbox::new("checkbox-disabled", Selection::Unselected).disabled(true))
|
|
.child(
|
|
Checkbox::new("checkbox-disabled-intermediate", Selection::Indeterminate)
|
|
.disabled(true),
|
|
)
|
|
.child(
|
|
Checkbox::new("checkbox-disabled-selected", Selection::Selected)
|
|
.disabled(true),
|
|
),
|
|
)
|
|
}
|
|
}
|