Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix hit boxes and hover styles for new buttons
Mikayla2f3c3d510fbc
diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rsindex 39543c8defe..7bcaa5be661 100644--- a/crates/collab_ui/src/collab_panel.rs+++ b/crates/collab_ui/src/collab_panel.rs@@ -1937,6 +1937,8 @@ impl CollabPanel {is_dragged_over = true;}+ let has_messages_notification = channel.unseen_message_id.is_some();+MouseEventHandler::new::<Channel, _>(ix, cx, |state, cx| {let row_hovered = state.hovered();@@ -2022,24 +2024,33 @@ impl CollabPanel {.flex(1., true)}).with_child(- MouseEventHandler::new::<ChannelNote, _>(ix, cx, move |_, _| {+ MouseEventHandler::new::<ChannelNote, _>(ix, cx, move |mouse_state, _| {+ let container_style = collab_theme+ .disclosure+ .button+ .style_for(mouse_state)+ .container;+if channel.unseen_message_id.is_some() {Svg::new("icons/conversations.svg").with_color(collab_theme.channel_note_active_color).constrained().with_width(collab_theme.channel_hash.width)+ .contained()+ .with_style(container_style)+ .with_uniform_padding(4.).into_any()} else if row_hovered {Svg::new("icons/conversations.svg").with_color(collab_theme.channel_hash.color).constrained().with_width(collab_theme.channel_hash.width)+ .contained()+ .with_style(container_style)+ .with_uniform_padding(4.).into_any()} else {- Empty::new()- .constrained()- .with_width(collab_theme.channel_hash.width)- .into_any()+ Empty::new().into_any()}}).on_click(MouseButton::Left, move |_, this, cx| {@@ -2056,7 +2067,12 @@ impl CollabPanel {.with_margin_right(4.),).with_child(- MouseEventHandler::new::<ChannelCall, _>(ix, cx, move |_, cx| {+ MouseEventHandler::new::<ChannelCall, _>(ix, cx, move |mouse_state, cx| {+ let container_style = collab_theme+ .disclosure+ .button+ .style_for(mouse_state)+ .container;if row_hovered || channel.unseen_note_version.is_some() {Svg::new("icons/file.svg").with_color(if channel.unseen_note_version.is_some() {@@ -2067,6 +2083,8 @@ impl CollabPanel {.constrained().with_width(collab_theme.channel_hash.width).contained()+ .with_style(container_style)+ .with_uniform_padding(4.).with_margin_right(collab_theme.channel_hash.container.margin.left).with_tooltip::<NotesTooltip>(ix as usize,@@ -2076,13 +2094,16 @@ impl CollabPanel {cx,).into_any()- } else {+ } else if has_messages_notification {Empty::new().constrained().with_width(collab_theme.channel_hash.width).contained()+ .with_uniform_padding(4.).with_margin_right(collab_theme.channel_hash.container.margin.left).into_any()+ } else {+ Empty::new().into_any()}}).on_click(MouseButton::Left, move |_, this, cx| {diff --git a/styles/src/style_tree/component_test.ts b/styles/src/style_tree/component_test.tsindex 71057c67eac..8dc22eec31a 100644--- a/styles/src/style_tree/component_test.ts+++ b/styles/src/style_tree/component_test.ts@@ -21,6 +21,7 @@ export default function contacts_panel(): any {...text(theme.lowest, "sans", "base"),button: icon_button({ variant: "ghost" }),spacing: 4,+ padding: 4,},}}