story.rs

 1use gpui::prelude::*;
 2use gpui::{div, hsla, Div, SharedString};
 3
 4pub struct Story {}
 5
 6impl Story {
 7    pub fn container() -> Div {
 8        div().size_full().flex().flex_col().pt_2().px_4().bg(hsla(
 9            0. / 360.,
10            0. / 100.,
11            100. / 100.,
12            1.,
13        ))
14    }
15
16    pub fn title(title: impl Into<SharedString>) -> impl Element {
17        div()
18            .text_xl()
19            .text_color(hsla(0. / 360., 0. / 100., 0. / 100., 1.))
20            .child(title.into())
21    }
22
23    pub fn title_for<T>() -> impl Element {
24        Self::title(std::any::type_name::<T>())
25    }
26
27    pub fn label(label: impl Into<SharedString>) -> impl Element {
28        div()
29            .mt_4()
30            .mb_2()
31            .text_xs()
32            .text_color(hsla(0. / 360., 0. / 100., 0. / 100., 1.))
33            .child(label.into())
34    }
35}