Add ListItem story

This commit is contained in:
Marshall Bowers
2023-11-27 14:20:33 -05:00
parent feb7753a73
commit 19ecccb107
3 changed files with 35 additions and 6 deletions
+2
View File
@@ -6,6 +6,7 @@ mod icon;
mod input;
mod keybinding;
mod label;
mod list_item;
pub use avatar::*;
pub use button::*;
@@ -15,3 +16,4 @@ pub use icon::*;
pub use input::*;
pub use keybinding::*;
pub use label::*;
pub use list_item::*;
@@ -0,0 +1,26 @@
use gpui::{Div, Render};
use story::Story;
use crate::prelude::*;
use crate::ListItem;
pub struct ListItemStory;
impl Render for ListItemStory {
type Element = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container()
.child(Story::title_for::<ListItem>())
.child(Story::label("Default"))
.child(ListItem::new("hello_world").child("Hello, world!"))
.child(Story::label("With `on_click`"))
.child(
ListItem::new("with_on_click")
.child("Click me")
.on_click(|_event, _cx| {
println!("Clicked!");
}),
)
}
}