1use strum::IntoEnumIterator;
2use ui::prelude::*;
3
4use crate::story::Story;
5use crate::story_selector::{ComponentStory, ElementStory};
6
7#[derive(Element, Default)]
8pub struct KitchenSinkStory {}
9
10impl KitchenSinkStory {
11 fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
12 let element_stories = ElementStory::iter().map(|selector| selector.story());
13 let component_stories = ComponentStory::iter().map(|selector| selector.story());
14
15 Story::container(cx)
16 .overflow_y_scroll(ScrollState::default())
17 .child(Story::title(cx, "Kitchen Sink"))
18 .child(Story::label(cx, "Elements"))
19 .child(div().flex().flex_col().children_any(element_stories))
20 .child(Story::label(cx, "Components"))
21 .child(div().flex().flex_col().children_any(component_stories))
22 // Add a bit of space at the bottom of the kitchen sink so elements
23 // don't end up squished right up against the bottom of the screen.
24 .child(div().p_4())
25 }
26}