avatar.rs

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