zed2 notification panel (#3603)

Release Notes:

- N/A
This commit is contained in:
Julia 2023-12-12 18:04:47 -05:00 committed by GitHub
commit 2e00da5a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 874 additions and 1098 deletions

View file

@ -1,6 +1,5 @@
use crate::prelude::*;
use gpui::{img, Div, Hsla, ImageData, ImageSource, Img, IntoElement, Styled};
use std::sync::Arc;
use gpui::{img, Div, Hsla, ImageSource, Img, IntoElement, Styled};
#[derive(Debug, Default, PartialEq, Clone)]
pub enum Shape {
@ -58,16 +57,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,

View file

@ -111,7 +111,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
}
}

View file

@ -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),
)
}