git_ui: Fix graph icon button design in the panel (#49099)

Adding the Git Graph icon and adjusting button sizing, spacing, and
positioning within the Git panel.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2026-02-13 10:39:30 -03:00 committed by GitHub
parent 51d34a5b47
commit 8afc67345f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 47 additions and 38 deletions

View file

@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3 3V11.8889C3 12.1836 3.11706 12.4662 3.32544 12.6746C3.53381 12.8829 3.81643 13 4.11111 13H13" stroke="#C6CAD0" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.8889 6.33333L9.11112 9.11111L6.8889 6.88888L5.22223 8.55555" stroke="#C6CAD0" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 453 B

View file

@ -4478,10 +4478,10 @@ impl GitPanel {
.child(
div()
.id("commit-msg-hover")
.px_1()
.cursor_pointer()
.line_clamp(1)
.px_1()
.rounded_sm()
.line_clamp(1)
.hover(|s| s.bg(cx.theme().colors().element_hover))
.child(
Label::new(commit.subject.clone())
@ -4517,42 +4517,46 @@ impl GitPanel {
}
}),
)
.when(commit.has_parent, |this| {
let has_unstaged = self.has_unstaged_changes();
this.pr_2().child(
h_flex().gap_1().child(
panel_icon_button("undo", IconName::Undo)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.tooltip(move |_window, cx| {
Tooltip::with_meta(
"Uncommit",
Some(&git::Uncommit),
if has_unstaged {
"git reset HEAD^ --soft"
} else {
"git reset HEAD^"
},
cx,
)
})
.on_click(
cx.listener(|this, _, window, cx| this.uncommit(window, cx)),
),
),
)
})
.when(window.is_action_available(&Open, cx), |this| {
this.child(
panel_icon_button("git-graph-button", IconName::ListTree)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.tooltip(|_window, cx| Tooltip::for_action("Open Git Graph", &Open, cx))
.on_click(|_, window, cx| {
window.dispatch_action(Open.boxed_clone(), cx)
}),
)
}),
.child(
h_flex()
.gap_0p5()
.when(commit.has_parent, |this| {
let has_unstaged = self.has_unstaged_changes();
this.child(
panel_icon_button("undo", IconName::Undo)
.icon_size(IconSize::Small)
.tooltip(move |_window, cx| {
Tooltip::with_meta(
"Uncommit",
Some(&git::Uncommit),
if has_unstaged {
"git reset HEAD^ --soft"
} else {
"git reset HEAD^"
},
cx,
)
})
.on_click(
cx.listener(|this, _, window, cx| {
this.uncommit(window, cx)
}),
),
)
})
.when(window.is_action_available(&Open, cx), |this| {
this.child(
panel_icon_button("git-graph-button", IconName::GitGraph)
.icon_size(IconSize::Small)
.tooltip(|_window, cx| {
Tooltip::for_action("Open Git Graph", &Open, cx)
})
.on_click(|_, window, cx| {
window.dispatch_action(Open.boxed_clone(), cx)
}),
)
}),
),
)
}

View file

@ -142,6 +142,7 @@ pub enum IconName {
GitBranch,
GitBranchAlt,
GitBranchPlus,
GitGraph,
Github,
Hash,
HistoryRerun,