1use gpui::{Div, Render};
2use story::Story;
3
4use crate::prelude::*;
5use crate::ListItem;
6
7pub struct ListItemStory;
8
9impl Render for ListItemStory {
10 type Element = Div;
11
12 fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
13 Story::container()
14 .child(Story::title_for::<ListItem>())
15 .child(Story::label("Default"))
16 .child(ListItem::new("hello_world").child("Hello, world!"))
17 .child(Story::label("With `on_click`"))
18 .child(
19 ListItem::new("with_on_click")
20 .child("Click me")
21 .on_click(|_event, _cx| {
22 println!("Clicked!");
23 }),
24 )
25 .child(Story::label("With `on_secondary_mouse_down`"))
26 .child(
27 ListItem::new("with_on_secondary_mouse_down")
28 .child("Right click me")
29 .on_secondary_mouse_down(|_event, _cx| {
30 println!("Right mouse down!");
31 }),
32 )
33 }
34}