list_header.rs

 1use gpui::Render;
 2use story::Story;
 3
 4use crate::{IconButton, prelude::*};
 5use crate::{IconName, ListHeader};
 6
 7pub struct ListHeaderStory;
 8
 9impl Render for ListHeaderStory {
10    fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
11        Story::container(cx)
12            .child(Story::title_for::<ListHeader>(cx))
13            .child(Story::label("Default", cx))
14            .child(ListHeader::new("Section 1"))
15            .child(Story::label("With left icon", cx))
16            .child(ListHeader::new("Section 2").start_slot(Icon::new(IconName::Bell)))
17            .child(Story::label("With left icon and meta", cx))
18            .child(
19                ListHeader::new("Section 3")
20                    .start_slot(Icon::new(IconName::BellOff))
21                    .end_slot(IconButton::new("action_1", IconName::BoltFilled)),
22            )
23            .child(Story::label("With multiple meta", cx))
24            .child(
25                ListHeader::new("Section 4")
26                    .end_slot(IconButton::new("action_1", IconName::BoltFilled))
27                    .end_slot(IconButton::new("action_2", IconName::Warning))
28                    .end_slot(IconButton::new("action_3", IconName::Plus)),
29            )
30    }
31}