diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index d0307d5625..8c708e619a 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -24,8 +24,8 @@ use smallvec::SmallVec; use std::sync::Arc; use theme::ActiveTheme; use ui::{ - h_flex, prelude::*, Avatar, Button, ButtonLike, ButtonStyle, ContextMenu, Icon, - IconButtonShape, IconName, IconSize, Indicator, PopoverMenu, Tooltip, + h_flex, prelude::*, Avatar, Button, ButtonLike, ButtonStyle, ContextMenu, Icon, IconName, + IconSize, IconWithIndicator, Indicator, PopoverMenu, Tooltip, }; use util::ResultExt; use vcs_menu::{BranchList, OpenRecent as ToggleVcsMenu}; @@ -281,8 +281,6 @@ impl TitleBar { } }; - let indicator_border_color = cx.theme().colors().title_bar_background; - let icon_color = match self.project.read(cx).ssh_connection_state(cx)? { remote::ConnectionState::Connecting => Color::Info, remote::ConnectionState::Connected => Color::Default, @@ -293,42 +291,22 @@ impl TitleBar { let meta = SharedString::from(meta); - let indicator = h_flex() - // We're using the circle inside a circle approach because, otherwise, by using borders - // we'd get a very thin, leaking indicator color, which is not what we want. - .absolute() - .size_2p5() - .right_0() - .bottom_0() - .bg(indicator_border_color) - .size_2p5() - .rounded_full() - .items_center() - .justify_center() - .overflow_hidden() - .child(Indicator::dot().color(indicator_color)); - Some( - div() - .relative() + ButtonLike::new("ssh-server-icon") .child( - IconButton::new("ssh-server-icon", IconName::Server) - .icon_size(IconSize::Small) - .shape(IconButtonShape::Square) - .icon_color(icon_color) - .tooltip(move |cx| { - Tooltip::with_meta( - "Remote Project", - Some(&OpenRemote), - meta.clone(), - cx, - ) - }) - .on_click(|_, cx| { - cx.dispatch_action(OpenRemote.boxed_clone()); - }), + IconWithIndicator::new( + Icon::new(IconName::Server).color(icon_color), + Some(Indicator::dot().color(indicator_color)), + ) + .indicator_border_color(Some(cx.theme().colors().title_bar_background)) + .into_any_element(), ) - .child(indicator) + .tooltip(move |cx| { + Tooltip::with_meta("Remote Project", Some(&OpenRemote), meta.clone(), cx) + }) + .on_click(|_, cx| { + cx.dispatch_action(OpenRemote.boxed_clone()); + }) .into_any_element(), ) } diff --git a/crates/ui/src/components/icon.rs b/crates/ui/src/components/icon.rs index 8d374ef67c..683bcec5a8 100644 --- a/crates/ui/src/components/icon.rs +++ b/crates/ui/src/components/icon.rs @@ -473,13 +473,12 @@ impl RenderOnce for IconWithIndicator { this.child( div() .absolute() - .w_2() - .h_2() - .border_1() + .size_2p5() + .border_2() .border_color(indicator_border_color) .rounded_full() .bottom_neg_0p5() - .right_neg_1() + .right_neg_0p5() .child(indicator), ) })