1use gpui2::Div;
2
3use crate::prelude::*;
4
5pub struct Story {}
6
7impl Story {
8 pub fn container<V: 'static>(cx: &mut ViewContext<V>) -> Div<V> {
9 let theme = theme(cx);
10
11 div()
12 .size_full()
13 .flex()
14 .flex_col()
15 .pt_2()
16 .px_4()
17 .font("Zed Mono")
18 .bg(theme.background)
19 }
20
21 pub fn title<V: 'static>(cx: &mut ViewContext<V>, title: &str) -> impl Component<V> {
22 let theme = theme(cx);
23
24 div()
25 .text_xl()
26 .text_color(theme.text)
27 .child(title.to_owned())
28 }
29
30 pub fn title_for<V: 'static, T>(cx: &mut ViewContext<V>) -> impl Component<V> {
31 Self::title(cx, std::any::type_name::<T>())
32 }
33
34 pub fn label<V: 'static>(cx: &mut ViewContext<V>, label: &str) -> impl Component<V> {
35 let theme = theme(cx);
36
37 div()
38 .mt_4()
39 .mb_2()
40 .text_xs()
41 .text_color(theme.text)
42 .child(label.to_owned())
43 }
44}