avatar.rs

 1use ui::prelude::*;
 2use ui::Avatar;
 3
 4use crate::story::Story;
 5
 6#[derive(Element, Default)]
 7pub struct AvatarStory {}
 8
 9impl AvatarStory {
10    fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
11        Story::container(cx)
12            .child(Story::title_for::<_, Avatar>(cx))
13            .child(Story::label(cx, "Default"))
14            .child(Avatar::new(
15                "https://avatars.githubusercontent.com/u/1714999?v=4",
16            ))
17            .child(Story::label(cx, "Rounded rectangle"))
18            .child(
19                Avatar::new("https://avatars.githubusercontent.com/u/1714999?v=4")
20                    .shape(Shape::RoundedRectangle),
21            )
22    }
23}