1use crate::{
2 story::Story,
3 story_selector::{ComponentStory, ElementStory},
4};
5use gpui2::{Div, Render, StatefulInteraction, View, VisualContext};
6use strum::IntoEnumIterator;
7use ui::prelude::*;
8
9pub struct KitchenSinkStory;
10
11impl KitchenSinkStory {
12 pub fn view(cx: &mut WindowContext) -> View<Self> {
13 cx.build_view(|cx| Self)
14 }
15}
16
17impl Render for KitchenSinkStory {
18 type Element = Div<Self, StatefulInteraction<Self>>;
19
20 fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
21 let element_stories = ElementStory::iter()
22 .map(|selector| selector.story(cx))
23 .collect::<Vec<_>>();
24 let component_stories = ComponentStory::iter()
25 .map(|selector| selector.story(cx))
26 .collect::<Vec<_>>();
27
28 Story::container(cx)
29 .id("kitchen-sink")
30 .overflow_y_scroll()
31 .child(Story::title(cx, "Kitchen Sink"))
32 .child(Story::label(cx, "Elements"))
33 .child(div().flex().flex_col().children(element_stories))
34 .child(Story::label(cx, "Components"))
35 .child(div().flex().flex_col().children(component_stories))
36 // Add a bit of space at the bottom of the kitchen sink so elements
37 // don't end up squished right up against the bottom of the screen.
38 .child(div().p_4())
39 }
40}