From b9be2147e8846d7abc630b54c1300cd1f75a4c57 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Mon, 15 Jan 2024 18:11:01 +0100 Subject: [PATCH] Fix unaligned close button in tab bar Co-authored-by: Marshall --- crates/assistant/src/assistant_panel.rs | 2 +- crates/collab_ui/src/chat_panel.rs | 2 +- crates/collab_ui/src/notification_panel.rs | 2 +- crates/ui/src/components/tab.rs | 8 +++++--- crates/ui/src/components/tab_bar.rs | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs index 7ae4955483f42358f1eeb67c5fad5b330d228204..df3dc3754f66aff8d83a6fcd3b92edd38c7c4e45 100644 --- a/crates/assistant/src/assistant_panel.rs +++ b/crates/assistant/src/assistant_panel.rs @@ -1119,7 +1119,7 @@ impl Render for AssistantPanel { ) .children(self.active_editor().map(|editor| { h_flex() - .h(rems(Tab::HEIGHT_IN_REMS)) + .h(rems(Tab::CONTAINER_HEIGHT_IN_REMS)) .flex_1() .px_2() .child(Label::new(editor.read(cx).title(cx)).into_element()) diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rs index cc271a5f5e13bec9d083d65d96974decc71967d6..921e3388a65637fad51f9a093f8538500965923a 100644 --- a/crates/collab_ui/src/chat_panel.rs +++ b/crates/collab_ui/src/chat_panel.rs @@ -523,7 +523,7 @@ impl Render for ChatPanel { TabBar::new("chat_header").child( h_flex() .w_full() - .h(rems(ui::Tab::HEIGHT_IN_REMS)) + .h(rems(ui::Tab::CONTAINER_HEIGHT_IN_REMS)) .px_2() .child(Label::new( self.active_chat diff --git a/crates/collab_ui/src/notification_panel.rs b/crates/collab_ui/src/notification_panel.rs index 72c7d4fe6980a856b6d5a0745d86772c87feae48..b30f8d15f035b5bc49e08449d20efd21b0e5b8c9 100644 --- a/crates/collab_ui/src/notification_panel.rs +++ b/crates/collab_ui/src/notification_panel.rs @@ -549,7 +549,7 @@ impl Render for NotificationPanel { .px_2() .py_1() // Match the height of the tab bar so they line up. - .h(rems(ui::Tab::HEIGHT_IN_REMS)) + .h(rems(ui::Tab::CONTAINER_HEIGHT_IN_REMS)) .border_b_1() .border_color(cx.theme().colors().border) .child(Label::new("Notifications")) diff --git a/crates/ui/src/components/tab.rs b/crates/ui/src/components/tab.rs index 7538d809ef3a9ead6a3facef51f6cba675a118cc..ade939fdaabcddfcdc6ac0a22b0222ff4f2b4170 100644 --- a/crates/ui/src/components/tab.rs +++ b/crates/ui/src/components/tab.rs @@ -48,7 +48,9 @@ impl Tab { } } - pub const HEIGHT_IN_REMS: f32 = 30. / 16.; + pub const CONTAINER_HEIGHT_IN_REMS: f32 = 29. / 16.; + + const CONTENT_HEIGHT_IN_REMS: f32 = 28. / 16.; pub fn position(mut self, position: TabPosition) -> Self { self.position = position; @@ -111,7 +113,7 @@ impl RenderOnce for Tab { }; self.div - .h(rems(Self::HEIGHT_IN_REMS)) + .h(rems(Self::CONTAINER_HEIGHT_IN_REMS)) .bg(tab_bg) .border_color(cx.theme().colors().border) .map(|this| match self.position { @@ -138,7 +140,7 @@ impl RenderOnce for Tab { h_flex() .group("") .relative() - .h_full() + .h(rems(Self::CONTENT_HEIGHT_IN_REMS)) .px_5() .gap_1() .text_color(text_color) diff --git a/crates/ui/src/components/tab_bar.rs b/crates/ui/src/components/tab_bar.rs index 1f7179c393b686f0a7c7c4a6a49179ea2a609f87..adee8389e47a8db3f343e01cc9d81a9c1d08ead4 100644 --- a/crates/ui/src/components/tab_bar.rs +++ b/crates/ui/src/components/tab_bar.rs @@ -90,7 +90,7 @@ impl ParentElement for TabBar { impl RenderOnce for TabBar { fn render(self, cx: &mut WindowContext) -> impl IntoElement { - const HEIGHT_IN_REMS: f32 = 30. / 16.; + const HEIGHT_IN_REMS: f32 = 29. / 16.; div() .id(self.id)