kitchen_sink.rs

 1use gpui::{Entity, Render, prelude::*};
 2use story::Story;
 3use strum::IntoEnumIterator;
 4use ui::prelude::*;
 5
 6use crate::story_selector::ComponentStory;
 7
 8pub struct KitchenSinkStory;
 9
10impl KitchenSinkStory {
11    pub fn model(cx: &mut App) -> Entity<Self> {
12        cx.new(|_| Self)
13    }
14}
15
16impl Render for KitchenSinkStory {
17    fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
18        let component_stories = ComponentStory::iter()
19            .map(|selector| selector.story(window, cx))
20            .collect::<Vec<_>>();
21
22        Story::container(cx)
23            .id("kitchen-sink")
24            .overflow_y_scroll()
25            .child(Story::title("Kitchen Sink", cx))
26            .child(Story::label("Components", cx))
27            .child(div().flex().flex_col().children(component_stories))
28            // Add a bit of space at the bottom of the kitchen sink so elements
29            // don't end up squished right up against the bottom of the screen.
30            .child(div().p_4())
31    }
32}