Rework Avatar indicator to be more general-purpose (#4073)

This PR reworks the way we add indicators to `Avatar`s to make them more
general-purpose.

Previously we had logic specific to the availability indicator embedded
in the `Avatar` component, which made it unwieldy to repurpose for
something else.

Now the `indicator` is just a slot that we can put anything into.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2024-01-16 14:05:05 -05:00
committed by GitHub
parent d00067cd86
commit ca4a8b2226
5 changed files with 222 additions and 176 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
use gpui::Render;
use story::Story;
use crate::prelude::*;
use crate::Avatar;
use crate::{prelude::*, Availability, AvatarAvailabilityIndicator};
pub struct AvatarStory;
@@ -19,11 +19,11 @@ impl Render for AvatarStory {
))
.child(
Avatar::new("https://avatars.githubusercontent.com/u/326587?v=4")
.availability_indicator(true),
.indicator(AvatarAvailabilityIndicator::new(Availability::Free)),
)
.child(
Avatar::new("https://avatars.githubusercontent.com/u/326587?v=4")
.availability_indicator(false),
.indicator(AvatarAvailabilityIndicator::new(Availability::Busy)),
)
}
}