Show the correct icon in status bar

This commit is contained in:
Antonio Scandurra 2022-09-13 17:00:11 +02:00
parent 97ccb16c97
commit 0f9ff57568
3 changed files with 7 additions and 41 deletions

View file

@ -1,4 +1,4 @@
use gpui::{color::Color, elements::*, Entity, RenderContext, View};
use gpui::{elements::*, Entity, RenderContext, View};
pub struct ContactsStatusItem;
@ -11,24 +11,8 @@ impl View for ContactsStatusItem {
"ContactsStatusItem"
}
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
MouseEventHandler::new::<Self, _, _>(0, cx, |state, cx| {
Svg::new("icons/zed_32.svg")
.with_color(if state.clicked.is_some() {
Color::red()
} else {
Color::blue()
})
.boxed()
})
.on_down(gpui::MouseButton::Left, |_, _| {})
.on_down_out(gpui::MouseButton::Left, |_, _| {})
.on_up(gpui::MouseButton::Left, |_, _| {})
.on_up_out(gpui::MouseButton::Left, |_, _| {})
.aligned()
.contained()
.with_background_color(Color::green())
.boxed()
fn render(&mut self, _: &mut RenderContext<Self>) -> ElementBox {
Svg::new("icons/zed_22.svg").aligned().boxed()
}
}