Use enabled for active tabs

This commit is contained in:
Nate Butler 2023-09-11 11:40:03 -04:00
parent 917884ffaf
commit 1376115db2
3 changed files with 9 additions and 10 deletions

View file

@ -25,9 +25,8 @@ impl IconButton {
let theme = theme(cx);
let mut div = div();
if self.variant == ButtonVariant::Filled {
div = div.fill(theme.highest.negative.default.background);
div = div.fill(theme.highest.on.default.background);
}
div.w_7()

View file

@ -6,11 +6,11 @@ use gpui2::{Element, ParentElement, ViewContext};
#[derive(Element)]
pub(crate) struct Tab {
title: &'static str,
active: bool,
enabled: bool,
}
pub fn tab<V: 'static>(title: &'static str, active: bool) -> impl Element<V> {
Tab { title, active }
pub fn tab<V: 'static>(title: &'static str, enabled: bool) -> impl Element<V> {
Tab { title, enabled }
}
impl Tab {
@ -24,19 +24,19 @@ impl Tab {
.items_center()
.justify_center()
.rounded_lg()
.fill(if self.active {
.fill(if self.enabled {
theme.highest.on.default.background
} else {
theme.highest.base.default.background
})
.hover()
.fill(if self.active {
.fill(if self.enabled {
theme.highest.on.hovered.background
} else {
theme.highest.base.hovered.background
})
.active()
.fill(if self.active {
.fill(if self.enabled {
theme.highest.on.pressed.background
} else {
theme.highest.base.pressed.background
@ -44,7 +44,7 @@ impl Tab {
.child(
div()
.text_sm()
.text_color(if self.active {
.text_color(if self.enabled {
theme.highest.base.default.foreground
} else {
theme.highest.variant.default.foreground

View file

@ -40,7 +40,7 @@ impl<V: 'static> TabBar<V> {
.flex()
.items_center()
.gap_px()
.child(icon_button("icons/arrow_left.svg", ButtonVariant::Ghost))
.child(icon_button("icons/arrow_left.svg", ButtonVariant::Filled))
.child(icon_button("icons/arrow_right.svg", ButtonVariant::Ghost)),
),
)