story.rs

 1use gpui2::elements::div;
 2use gpui2::style::StyleHelpers;
 3use gpui2::{rgb, Element, Hsla, ParentElement};
 4
 5pub struct Story {}
 6
 7impl Story {
 8    pub fn container<V: 'static>() -> div::Div<V> {
 9        div()
10            .size_full()
11            .flex()
12            .flex_col()
13            .pt_2()
14            .px_4()
15            .font("Zed Mono Extended")
16            .fill(rgb::<Hsla>(0x282c34))
17    }
18
19    pub fn title<V: 'static>(title: &str) -> impl Element<V> {
20        div()
21            .text_xl()
22            .text_color(rgb::<Hsla>(0xffffff))
23            .child(title.to_owned())
24    }
25
26    pub fn title_for<V: 'static, T>() -> impl Element<V> {
27        Self::title(std::any::type_name::<T>())
28    }
29
30    pub fn label<V: 'static>(label: &str) -> impl Element<V> {
31        div()
32            .mt_4()
33            .mb_2()
34            .text_xs()
35            .text_color(rgb::<Hsla>(0xffffff))
36            .child(label.to_owned())
37    }
38}