Start changing Avatar to use URI
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
co-authored by
Antonio Scandurra
parent
376716254f
commit
44d40625fe
@@ -58,16 +58,8 @@ impl RenderOnce for Avatar {
|
||||
}
|
||||
|
||||
impl Avatar {
|
||||
pub fn uri(src: impl Into<SharedString>) -> Self {
|
||||
Self::source(src.into().into())
|
||||
}
|
||||
|
||||
pub fn data(src: Arc<ImageData>) -> Self {
|
||||
Self::source(src.into())
|
||||
}
|
||||
|
||||
pub fn source(src: ImageSource) -> Self {
|
||||
Self {
|
||||
pub fn new(src: impl Into<ImageSource>) -> Self {
|
||||
Avatar {
|
||||
image: img(src),
|
||||
is_available: None,
|
||||
border_color: None,
|
||||
|
||||
@@ -107,7 +107,7 @@ impl ListItem {
|
||||
}
|
||||
|
||||
pub fn left_avatar(mut self, left_avatar: impl Into<ImageSource>) -> Self {
|
||||
self.left_slot = Some(Avatar::source(left_avatar.into()).into_any_element());
|
||||
self.left_slot = Some(Avatar::new(left_avatar).into_any_element());
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,18 +13,18 @@ impl Render for AvatarStory {
|
||||
Story::container()
|
||||
.child(Story::title_for::<Avatar>())
|
||||
.child(Story::label("Default"))
|
||||
.child(Avatar::uri(
|
||||
.child(Avatar::new(
|
||||
"https://avatars.githubusercontent.com/u/1714999?v=4",
|
||||
))
|
||||
.child(Avatar::uri(
|
||||
.child(Avatar::new(
|
||||
"https://avatars.githubusercontent.com/u/326587?v=4",
|
||||
))
|
||||
.child(
|
||||
Avatar::uri("https://avatars.githubusercontent.com/u/326587?v=4")
|
||||
Avatar::new("https://avatars.githubusercontent.com/u/326587?v=4")
|
||||
.availability_indicator(true),
|
||||
)
|
||||
.child(
|
||||
Avatar::uri("https://avatars.githubusercontent.com/u/326587?v=4")
|
||||
Avatar::new("https://avatars.githubusercontent.com/u/326587?v=4")
|
||||
.availability_indicator(false),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user