1use gpui::{Div, Render};
2use story::Story;
3
4use crate::{prelude::*, Tooltip};
5use crate::{Icon, IconButton};
6
7pub struct IconButtonStory;
8
9impl Render for IconButtonStory {
10 type Element = Div;
11
12 fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
13 Story::container()
14 .child(Story::title_for::<IconButton>())
15 .child(Story::label("Default"))
16 .child(div().w_8().child(IconButton::new("icon_a", Icon::Hash)))
17 .child(Story::label("With `on_click`"))
18 .child(
19 div()
20 .w_8()
21 .child(
22 IconButton::new("with_on_click", Icon::Ai).on_click(|_event, _cx| {
23 println!("Clicked!");
24 }),
25 ),
26 )
27 .child(Story::label("With `tooltip`"))
28 .child(
29 div().w_8().child(
30 IconButton::new("with_tooltip", Icon::MessageBubbles)
31 .tooltip(|cx| Tooltip::text("Open messages", cx)),
32 ),
33 )
34 }
35}