Add spacing between tab bar buttons (#3799)

This PR adds spacing between buttons in the tab bar.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2023-12-22 19:18:04 -05:00 committed by GitHub
parent e1d8e2001b
commit f03ee1ea24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -377,6 +377,7 @@ impl Pane {
can_split: true, can_split: true,
render_tab_bar_buttons: Rc::new(move |pane, cx| { render_tab_bar_buttons: Rc::new(move |pane, cx| {
h_stack() h_stack()
.gap_2()
.child( .child(
IconButton::new("plus", Icon::Plus) IconButton::new("plus", Icon::Plus)
.icon_size(IconSize::Small) .icon_size(IconSize::Small)
@ -1657,24 +1658,28 @@ impl Pane {
TabBar::new("tab_bar") TabBar::new("tab_bar")
.track_scroll(self.tab_bar_scroll_handle.clone()) .track_scroll(self.tab_bar_scroll_handle.clone())
.start_child( .start_child(
IconButton::new("navigate_backward", Icon::ArrowLeft) h_stack()
.icon_size(IconSize::Small) .gap_2()
.on_click({ .child(
let view = cx.view().clone(); IconButton::new("navigate_backward", Icon::ArrowLeft)
move |_, cx| view.update(cx, Self::navigate_backward) .icon_size(IconSize::Small)
}) .on_click({
.disabled(!self.can_navigate_backward()) let view = cx.view().clone();
.tooltip(|cx| Tooltip::for_action("Go Back", &GoBack, cx)), move |_, cx| view.update(cx, Self::navigate_backward)
) })
.start_child( .disabled(!self.can_navigate_backward())
IconButton::new("navigate_forward", Icon::ArrowRight) .tooltip(|cx| Tooltip::for_action("Go Back", &GoBack, cx)),
.icon_size(IconSize::Small) )
.on_click({ .child(
let view = cx.view().clone(); IconButton::new("navigate_forward", Icon::ArrowRight)
move |_, cx| view.update(cx, Self::navigate_backward) .icon_size(IconSize::Small)
}) .on_click({
.disabled(!self.can_navigate_forward()) let view = cx.view().clone();
.tooltip(|cx| Tooltip::for_action("Go Forward", &GoForward, cx)), move |_, cx| view.update(cx, Self::navigate_backward)
})
.disabled(!self.can_navigate_forward())
.tooltip(|cx| Tooltip::for_action("Go Forward", &GoForward, cx)),
),
) )
.end_child({ .end_child({
let render_tab_buttons = self.render_tab_bar_buttons.clone(); let render_tab_buttons = self.render_tab_bar_buttons.clone();