Continue refining theme, update tabs & tab bar

This commit is contained in:
Nate Butler 2023-11-01 01:41:33 -04:00
parent 0efd69c60f
commit bfb1f5ecf0
7 changed files with 52 additions and 38 deletions

View file

@ -108,13 +108,13 @@ impl Tab {
let close_icon = || IconElement::new(Icon::Close).color(IconColor::Muted);
let (tab_bg, tab_hover_bg, tab_active_bg) = match self.current {
true => (
cx.theme().colors().ghost_element,
false => (
cx.theme().colors().tab_inactive,
cx.theme().colors().ghost_element_hover,
cx.theme().colors().ghost_element_active,
),
false => (
cx.theme().colors().element,
true => (
cx.theme().colors().tab_active,
cx.theme().colors().element_hover,
cx.theme().colors().element_active,
),
@ -127,7 +127,7 @@ impl Tab {
div()
.id(self.id.clone())
.on_drag(move |_view, cx| cx.build_view(|cx| drag_state.clone()))
.drag_over::<TabDragState>(|d| d.bg(black()))
.drag_over::<TabDragState>(|d| d.bg(cx.theme().colors().element_drop_target))
.on_drop(|_view, state: View<TabDragState>, cx| {
dbg!(state.read(cx));
})
@ -144,7 +144,7 @@ impl Tab {
.px_1()
.flex()
.items_center()
.gap_1()
.gap_1p5()
.children(has_fs_conflict.then(|| {
IconElement::new(Icon::ExclamationTriangle)
.size(crate::IconSize::Small)

View file

@ -27,6 +27,7 @@ impl TabBar {
let (can_navigate_back, can_navigate_forward) = self.can_navigate;
div()
.group("tab_bar")
.id(self.id.clone())
.w_full()
.flex()
@ -34,6 +35,7 @@ impl TabBar {
// Left Side
.child(
div()
.relative()
.px_1()
.flex()
.flex_none()
@ -41,6 +43,7 @@ impl TabBar {
// Nav Buttons
.child(
div()
.right_0()
.flex()
.items_center()
.gap_px()
@ -67,10 +70,15 @@ impl TabBar {
// Right Side
.child(
div()
// We only use absolute here since we don't
// have opacity or `hidden()` yet
.absolute()
.neg_top_7()
.px_1()
.flex()
.flex_none()
.gap_2()
.group_hover("tab_bar", |this| this.top_0())
// Nav Buttons
.child(
div()

View file

@ -26,18 +26,16 @@ pub enum IconColor {
impl IconColor {
pub fn color(self, cx: &WindowContext) -> Hsla {
let theme_colors = cx.theme().colors();
match self {
IconColor::Default => theme_colors.icon,
IconColor::Muted => theme_colors.icon_muted,
IconColor::Disabled => theme_colors.icon_disabled,
IconColor::Placeholder => theme_colors.icon_placeholder,
IconColor::Accent => theme_colors.icon_accent,
IconColor::Error => gpui2::red(),
IconColor::Warning => gpui2::red(),
IconColor::Success => gpui2::red(),
IconColor::Info => gpui2::red(),
IconColor::Default => cx.theme().colors().icon,
IconColor::Muted => cx.theme().colors().icon_muted,
IconColor::Disabled => cx.theme().colors().icon_disabled,
IconColor::Placeholder => cx.theme().colors().icon_placeholder,
IconColor::Accent => cx.theme().colors().icon_accent,
IconColor::Error => cx.theme().status().error,
IconColor::Warning => cx.theme().status().warning,
IconColor::Success => cx.theme().status().success,
IconColor::Info => cx.theme().status().info,
}
}
}

View file

@ -79,8 +79,7 @@ impl Label {
this.relative().child(
div()
.absolute()
.top_px()
.my_auto()
.top_1_2()
.w_full()
.h_px()
.bg(LabelColor::Hidden.hsla(cx)),