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