refactor theme
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m46s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m35s
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m46s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m35s
This commit is contained in:
@@ -105,28 +105,33 @@ impl Sizable for Tab {
|
||||
|
||||
impl RenderOnce for Tab {
|
||||
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||
let (text_color, bg_color, hover_bg_color) = match (self.selected, self.disabled) {
|
||||
(true, false) => (
|
||||
cx.theme().text,
|
||||
cx.theme().tab_active_background,
|
||||
cx.theme().tab_hover_background,
|
||||
),
|
||||
(false, false) => (
|
||||
cx.theme().text_muted,
|
||||
cx.theme().ghost_element_background,
|
||||
cx.theme().tab_hover_background,
|
||||
),
|
||||
(true, true) => (
|
||||
cx.theme().text_muted,
|
||||
cx.theme().ghost_element_background,
|
||||
cx.theme().tab_hover_background,
|
||||
),
|
||||
(false, true) => (
|
||||
cx.theme().text_muted,
|
||||
cx.theme().ghost_element_background,
|
||||
cx.theme().tab_hover_background,
|
||||
),
|
||||
};
|
||||
let (text_color, bg_color, hover_bg_color, border_color) =
|
||||
match (self.selected, self.disabled) {
|
||||
(true, false) => (
|
||||
cx.theme().text,
|
||||
cx.theme().tab_active_background,
|
||||
cx.theme().tab_hover_background,
|
||||
cx.theme().border,
|
||||
),
|
||||
(false, false) => (
|
||||
cx.theme().text_muted,
|
||||
cx.theme().ghost_element_background,
|
||||
cx.theme().tab_hover_background,
|
||||
cx.theme().border_transparent,
|
||||
),
|
||||
(true, true) => (
|
||||
cx.theme().text_muted,
|
||||
cx.theme().ghost_element_background,
|
||||
cx.theme().tab_hover_background,
|
||||
cx.theme().border_disabled,
|
||||
),
|
||||
(false, true) => (
|
||||
cx.theme().text_muted,
|
||||
cx.theme().ghost_element_background,
|
||||
cx.theme().tab_hover_background,
|
||||
cx.theme().border_disabled,
|
||||
),
|
||||
};
|
||||
|
||||
self.base
|
||||
.id(self.ix)
|
||||
@@ -144,14 +149,9 @@ impl RenderOnce for Tab {
|
||||
.bg(bg_color)
|
||||
.border_l(px(1.))
|
||||
.border_r(px(1.))
|
||||
.border_color(cx.theme().border)
|
||||
.when(!self.selected, |this| {
|
||||
this.hover(|this| {
|
||||
this.text_color(text_color)
|
||||
.bg(hover_bg_color)
|
||||
.border_l(px(0.))
|
||||
.border_r(px(0.))
|
||||
})
|
||||
.border_color(border_color)
|
||||
.when(!self.selected && !self.disabled, |this| {
|
||||
this.hover(|this| this.text_color(text_color).bg(hover_bg_color))
|
||||
})
|
||||
.when_some(self.prefix, |this, prefix| {
|
||||
this.child(prefix).text_color(text_color)
|
||||
|
||||
@@ -122,7 +122,6 @@ impl RenderOnce for TabBar {
|
||||
h_flex()
|
||||
.id("tabs")
|
||||
.flex_grow()
|
||||
.gap_1()
|
||||
.overflow_x_scroll()
|
||||
.when_some(self.scroll_handle, |this, scroll_handle| {
|
||||
this.track_scroll(&scroll_handle)
|
||||
|
||||
Reference in New Issue
Block a user