Update project & git menus to be Toggleable<Interactive<ContainedText>>
Co-Authored-By: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
parent
0e0d78df84
commit
1baa13561d
3 changed files with 19 additions and 12 deletions
|
@ -221,17 +221,19 @@ impl CollabTitlebarItem {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(RepositoryEntry::branch)
|
.and_then(RepositoryEntry::branch)
|
||||||
.map(|branch| util::truncate_and_trailoff(&branch, MAX_BRANCH_NAME_LENGTH));
|
.map(|branch| util::truncate_and_trailoff(&branch, MAX_BRANCH_NAME_LENGTH));
|
||||||
let project_style = theme.titlebar.title.clone();
|
let project_style = theme.titlebar.project_menu_button.clone();
|
||||||
let git_style = theme.titlebar.git_branch.clone();
|
let git_style = theme.titlebar.git_menu_button.clone();
|
||||||
let divider_style = theme.titlebar.project_name_divider.clone();
|
let divider_style = theme.titlebar.project_name_divider.clone();
|
||||||
let item_spacing = theme.titlebar.item_spacing;
|
let item_spacing = theme.titlebar.item_spacing;
|
||||||
|
|
||||||
let mut ret = Flex::row().with_child(
|
let mut ret = Flex::row().with_child(
|
||||||
Stack::new()
|
Stack::new()
|
||||||
.with_child(
|
.with_child(
|
||||||
MouseEventHandler::<ToggleProjectMenu, Self>::new(0, cx, |_, _| {
|
MouseEventHandler::<ToggleProjectMenu, Self>::new(0, cx, |mouse_state, _| {
|
||||||
Label::new(name, project_style.text.clone())
|
let style = project_style.in_state(self.project_popover.is_some()).style_for(mouse_state);
|
||||||
|
Label::new(name, style.text.clone())
|
||||||
.contained()
|
.contained()
|
||||||
|
.with_style(style.container)
|
||||||
.aligned()
|
.aligned()
|
||||||
.left()
|
.left()
|
||||||
.into_any_named("title-project-name")
|
.into_any_named("title-project-name")
|
||||||
|
@ -241,8 +243,6 @@ impl CollabTitlebarItem {
|
||||||
this.toggle_project_menu(&Default::default(), cx)
|
this.toggle_project_menu(&Default::default(), cx)
|
||||||
})
|
})
|
||||||
.on_click(MouseButton::Left, move |_, _, _| {})
|
.on_click(MouseButton::Left, move |_, _, _| {})
|
||||||
.contained()
|
|
||||||
.with_style(project_style.container),
|
|
||||||
)
|
)
|
||||||
.with_children(self.render_project_popover_host(&theme.titlebar, cx)),
|
.with_children(self.render_project_popover_host(&theme.titlebar, cx)),
|
||||||
);
|
);
|
||||||
|
@ -259,9 +259,11 @@ impl CollabTitlebarItem {
|
||||||
.with_child(
|
.with_child(
|
||||||
Stack::new()
|
Stack::new()
|
||||||
.with_child(
|
.with_child(
|
||||||
MouseEventHandler::<ToggleVcsMenu, Self>::new(0, cx, |_, _| {
|
MouseEventHandler::<ToggleVcsMenu, Self>::new(0, cx, |mouse_state, _| {
|
||||||
Label::new(git_branch, git_style.text)
|
let style = git_style.in_state(self.branch_popover.is_some()).style_for(mouse_state);
|
||||||
|
Label::new(git_branch, style.text.clone())
|
||||||
.contained()
|
.contained()
|
||||||
|
.with_style(style.container.clone())
|
||||||
.with_margin_right(item_spacing)
|
.with_margin_right(item_spacing)
|
||||||
.aligned()
|
.aligned()
|
||||||
.left()
|
.left()
|
||||||
|
|
|
@ -118,9 +118,9 @@ pub struct Titlebar {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub container: ContainerStyle,
|
pub container: ContainerStyle,
|
||||||
pub height: f32,
|
pub height: f32,
|
||||||
pub title: ContainedText,
|
pub project_menu_button: Toggleable<Interactive<ContainedText>>,
|
||||||
pub project_name_divider: ContainedText,
|
pub project_name_divider: ContainedText,
|
||||||
pub git_branch: ContainedText,
|
pub git_menu_button: Toggleable<Interactive<ContainedText>>,
|
||||||
pub item_spacing: f32,
|
pub item_spacing: f32,
|
||||||
pub face_pile_spacing: f32,
|
pub face_pile_spacing: f32,
|
||||||
pub avatar_ribbon: AvatarRibbon,
|
pub avatar_ribbon: AvatarRibbon,
|
||||||
|
|
|
@ -173,9 +173,14 @@ export function titlebar(theme: ColorScheme): any {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
title: text(theme.lowest, "sans", "active"),
|
|
||||||
project_name_divider: text(theme.lowest, "sans", "variant"),
|
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',
|
||||||
|
}),
|
||||||
|
|
||||||
// Collaborators
|
// Collaborators
|
||||||
leader_avatar: {
|
leader_avatar: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue