Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Update project & git menus to be Toggleable<Interactive<ContainedText>>
Nate Butler1baa13561d37
diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rsindex 3bc890f91ba..c8f1d7cf303 100644--- a/crates/collab_ui/src/collab_titlebar_item.rs+++ b/crates/collab_ui/src/collab_titlebar_item.rs@@ -221,17 +221,19 @@ impl CollabTitlebarItem {.as_ref().and_then(RepositoryEntry::branch).map(|branch| util::truncate_and_trailoff(&branch, MAX_BRANCH_NAME_LENGTH));- let project_style = theme.titlebar.title.clone();- let git_style = theme.titlebar.git_branch.clone();+ let project_style = theme.titlebar.project_menu_button.clone();+ let git_style = theme.titlebar.git_menu_button.clone();let divider_style = theme.titlebar.project_name_divider.clone();let item_spacing = theme.titlebar.item_spacing;let mut ret = Flex::row().with_child(Stack::new().with_child(- MouseEventHandler::<ToggleProjectMenu, Self>::new(0, cx, |_, _| {- Label::new(name, project_style.text.clone())+ MouseEventHandler::<ToggleProjectMenu, Self>::new(0, cx, |mouse_state, _| {+ let style = project_style.in_state(self.project_popover.is_some()).style_for(mouse_state);+ Label::new(name, style.text.clone()).contained()+ .with_style(style.container).aligned().left().into_any_named("title-project-name")@@ -241,8 +243,6 @@ impl CollabTitlebarItem {this.toggle_project_menu(&Default::default(), cx)}).on_click(MouseButton::Left, move |_, _, _| {})- .contained()- .with_style(project_style.container),).with_children(self.render_project_popover_host(&theme.titlebar, cx)),);@@ -259,9 +259,11 @@ impl CollabTitlebarItem {.with_child(Stack::new().with_child(- MouseEventHandler::<ToggleVcsMenu, Self>::new(0, cx, |_, _| {- Label::new(git_branch, git_style.text)+ MouseEventHandler::<ToggleVcsMenu, Self>::new(0, cx, |mouse_state, _| {+ let style = git_style.in_state(self.branch_popover.is_some()).style_for(mouse_state);+ Label::new(git_branch, style.text.clone()).contained()+ .with_style(style.container.clone()).with_margin_right(item_spacing).aligned().left()diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rsindex a4fbcedd32c..3a7924f36ee 100644--- a/crates/theme/src/theme.rs+++ b/crates/theme/src/theme.rs@@ -118,9 +118,9 @@ pub struct Titlebar {#[serde(flatten)]pub container: ContainerStyle,pub height: f32,- pub title: ContainedText,+ pub project_menu_button: Toggleable<Interactive<ContainedText>>,pub project_name_divider: ContainedText,- pub git_branch: ContainedText,+ pub git_menu_button: Toggleable<Interactive<ContainedText>>,pub item_spacing: f32,pub face_pile_spacing: f32,pub avatar_ribbon: AvatarRibbon,diff --git a/styles/src/style_tree/titlebar.ts b/styles/src/style_tree/titlebar.tsindex 686f814a5d7..109db8db20c 100644--- a/styles/src/style_tree/titlebar.ts+++ b/styles/src/style_tree/titlebar.ts@@ -173,9 +173,14 @@ export function titlebar(theme: ColorScheme): any {},// Project- title: text(theme.lowest, "sans", "active"),project_name_divider: text(theme.lowest, "sans", "variant"),- git_branch: text(theme.lowest, "sans", "variant"),++ project_menu_button: toggleable_text_button(theme, {+ color: 'base',+ }),+ git_menu_button: toggleable_text_button(theme, {+ color: 'variant',+ }),// Collaboratorsleader_avatar: {