1use gpui3::Div;
2
3use crate::prelude::*;
4use crate::theme;
5
6pub struct Story {}
7
8impl Story {
9 pub fn container<S: 'static + Send + Sync>(cx: &mut ViewContext<S>) -> Div<S> {
10 let theme = theme(cx);
11
12 div()
13 .size_full()
14 .flex()
15 .flex_col()
16 .pt_2()
17 .px_4()
18 .font("Zed Mono Extended")
19 .fill(theme.lowest.base.default.background)
20 }
21
22 pub fn title<S: 'static + Send + Sync>(
23 cx: &mut ViewContext<S>,
24 title: &str,
25 ) -> impl Element<State = S> {
26 let theme = theme(cx);
27
28 div()
29 .text_xl()
30 .text_color(theme.lowest.base.default.foreground)
31 .child(title.to_owned())
32 }
33
34 pub fn title_for<S: 'static + Send + Sync, T>(
35 cx: &mut ViewContext<S>,
36 ) -> impl Element<State = S> {
37 Self::title(cx, std::any::type_name::<T>())
38 }
39
40 pub fn label<S: 'static + Send + Sync>(
41 cx: &mut ViewContext<S>,
42 label: &str,
43 ) -> impl Element<State = S> {
44 let theme = theme(cx);
45
46 div()
47 .mt_4()
48 .mb_2()
49 .text_xs()
50 .text_color(theme.lowest.base.default.foreground)
51 .child(label.to_owned())
52 }
53}