diff --git a/crates/ui/src/dock/tab_panel.rs b/crates/ui/src/dock/tab_panel.rs index 345f5fbe..bd10b5b0 100644 --- a/crates/ui/src/dock/tab_panel.rs +++ b/crates/ui/src/dock/tab_panel.rs @@ -290,6 +290,7 @@ impl TabPanel { .top_0() .right_0() .border_l_1() + .border_b_1() .h_full() .border_color(cx.theme().border) .bg(cx.theme().tab_bar) diff --git a/crates/ui/src/tab/tab.rs b/crates/ui/src/tab/tab.rs index eeb2d257..4a060ba2 100644 --- a/crates/ui/src/tab/tab.rs +++ b/crates/ui/src/tab/tab.rs @@ -2,7 +2,7 @@ use crate::theme::{ActiveTheme, Colorize}; use crate::Selectable; use gpui::prelude::FluentBuilder as _; use gpui::{ - div, AnyElement, Div, ElementId, InteractiveElement, IntoElement, ParentElement as _, + div, px, AnyElement, Div, ElementId, InteractiveElement, IntoElement, ParentElement as _, RenderOnce, Stateful, StatefulInteractiveElement, Styled, WindowContext, }; @@ -19,7 +19,7 @@ pub struct Tab { impl Tab { pub fn new(id: impl Into, label: impl IntoElement) -> Self { Self { - base: div().id(id.into()).gap_1().py_1p5().px_3().h_8(), + base: div().id(id.into()).gap_1().py_1p5().px_3().h(px(30.)), label: label.into_any_element(), disabled: false, selected: false, @@ -79,7 +79,6 @@ impl RenderOnce for Tab { .text_color(text_color) .bg(bg_color) .border_x_1() - .border_color(bg_color) .border_color(cx.theme().transparent) .when(self.selected, |this| this.border_color(cx.theme().border)) .text_sm() @@ -87,7 +86,7 @@ impl RenderOnce for Tab { .when_some(self.prefix, |this, prefix| { this.child(prefix).text_color(text_color) }) - .child(self.label) + .child(div().text_ellipsis().child(self.label)) .when_some(self.suffix, |this, suffix| this.child(suffix)) } } diff --git a/crates/ui/src/tab/tab_bar.rs b/crates/ui/src/tab/tab_bar.rs index be6ae6fc..41635141 100644 --- a/crates/ui/src/tab/tab_bar.rs +++ b/crates/ui/src/tab/tab_bar.rs @@ -21,7 +21,7 @@ pub struct TabBar { impl TabBar { pub fn new(id: impl Into) -> Self { Self { - base: div().h_8().px(px(-1.)), + base: div().px(px(-1.)), id: id.into(), children: SmallVec::new(), scroll_handle: ScrollHandle::new(), @@ -30,7 +30,7 @@ impl TabBar { } } - #[allow(unused)] + /// Track the scroll of the TabBar pub fn track_scroll(mut self, scroll_handle: ScrollHandle) -> Self { self.scroll_handle = scroll_handle; self @@ -63,27 +63,31 @@ impl Styled for TabBar { impl RenderOnce for TabBar { fn render(self, cx: &mut WindowContext) -> impl IntoElement { - let theme = cx.theme(); - self.base .id(self.id) .group("tab-bar") + .relative() .flex() .flex_none() .items_center() - .border_b_1() - .border_color(cx.theme().border) - .bg(theme.tab_bar) - .text_color(theme.tab_foreground) + .bg(cx.theme().tab_bar) + .text_color(cx.theme().tab_foreground) + .child( + div() + .id("border-b") + .absolute() + .bottom_0() + .size_full() + .border_b_1() + .border_color(cx.theme().border), + ) .when_some(self.prefix, |this, prefix| this.child(prefix)) - // The child will append to this level .child( h_flex() .id("tabs") .flex_grow() .overflow_x_scroll() .track_scroll(&self.scroll_handle) - // The children will append to this level .children(self.children), ) .when_some(self.suffix, |this, suffix| this.child(suffix))