diff --git a/crates/ui/src/indicator.rs b/crates/ui/src/indicator.rs index d42c0f3a..a62529a9 100644 --- a/crates/ui/src/indicator.rs +++ b/crates/ui/src/indicator.rs @@ -3,13 +3,13 @@ use std::time::Duration; use crate::{Icon, IconName, Sizable, Size}; use gpui::{ div, ease_in_out, percentage, prelude::FluentBuilder as _, Animation, AnimationExt as _, Hsla, - IntoElement, ParentElement, RenderOnce, Styled as _, Transformation, + IntoElement, ParentElement, RenderOnce, Styled as _, Transformation, WindowContext, }; #[derive(IntoElement)] pub struct Indicator { size: Size, - icon: IconName, + icon: Icon, speed: Duration, color: Option, } @@ -19,13 +19,13 @@ impl Indicator { Self { size: Size::Medium, speed: Duration::from_secs_f64(0.8), - icon: IconName::Loader, + icon: Icon::new(IconName::Loader), color: None, } } - pub fn icon(mut self, icon: IconName) -> Self { - self.icon = icon; + pub fn icon(mut self, icon: impl Into) -> Self { + self.icon = icon.into(); self } @@ -43,10 +43,10 @@ impl Sizable for Indicator { } impl RenderOnce for Indicator { - fn render(self, _: &mut gpui::WindowContext) -> impl IntoElement { + fn render(self, _: &mut WindowContext) -> impl IntoElement { div() .child( - Icon::new(self.icon.clone()) + self.icon .with_size(self.size) .when_some(self.color, |this, color| this.text_color(color)) .with_animation(