From 30b01b9bc0699763f2ea72dcd273dfe4d9da30d8 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 19 Dec 2023 11:03:08 -0500 Subject: [PATCH] Update imports, tab height const --- crates/assistant2/src/assistant_panel.rs | 9 +++------ crates/ui2/src/components/tab.rs | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/assistant2/src/assistant_panel.rs b/crates/assistant2/src/assistant_panel.rs index b0b1378dbd2e3c3f91e8ed5603f49cad1635c778..94be39f924ee6125e1d1a12fea35d271fe8ddc2e 100644 --- a/crates/assistant2/src/assistant_panel.rs +++ b/crates/assistant2/src/assistant_panel.rs @@ -53,10 +53,7 @@ use std::{ time::{Duration, Instant}, }; use theme::ThemeSettings; -use ui::{ - h_stack, prelude::*, v_stack, Button, ButtonLike, Icon, IconButton, IconElement, Label, TabBar, - Tooltip, TAB_HEIGHT_IN_REMS, -}; +use ui::{prelude::*, Tab, TabBar, Tooltip}; use util::{paths::CONVERSATIONS_DIR, post_inc, ResultExt, TryFutureExt}; use uuid::Uuid; use workspace::{ @@ -1129,13 +1126,13 @@ impl Render for AssistantPanel { .border() .border_color(gpui::red()) } else { - let header = TabBar::new("assistant_header") + let header = ui::TabBar::new("assistant_header") .start_child( h_stack().gap_1().child(Self::render_hamburger_button(cx)), // .children(title), ) .children(self.active_editor().map(|editor| { h_stack() - .h(rems(TAB_HEIGHT_IN_REMS)) + .h(rems(ui::Tab::HEIGHT_IN_REMS)) .flex_1() .px_2() .child(Label::new(editor.read(cx).title(cx)).into_element()) diff --git a/crates/ui2/src/components/tab.rs b/crates/ui2/src/components/tab.rs index 7f20a923299d27caca8f30a7b5b234d8525f98eb..eddfab811914b721126ccf777c9818498e405569 100644 --- a/crates/ui2/src/components/tab.rs +++ b/crates/ui2/src/components/tab.rs @@ -3,8 +3,6 @@ use gpui::{AnyElement, IntoElement, Stateful}; use smallvec::SmallVec; use std::cmp::Ordering; -pub const TAB_HEIGHT_IN_REMS: f32 = 30. / 16.; - /// The position of a [`Tab`] within a list of tabs. #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum TabPosition { @@ -50,6 +48,8 @@ impl Tab { } } + pub const HEIGHT_IN_REMS: f32 = 30. / 16.; + pub fn position(mut self, position: TabPosition) -> Self { self.position = position; self @@ -112,7 +112,7 @@ impl RenderOnce for Tab { }; self.div - .h(rems(TAB_HEIGHT_IN_REMS)) + .h(rems(Self::HEIGHT_IN_REMS)) .bg(tab_bg) .border_color(cx.theme().colors().border) .map(|this| match self.position {