Remove ThemeColor in favor of theme2::Theme

This commit is contained in:
Marshall Bowers 2023-10-25 16:32:44 +02:00
parent bb3f59252e
commit e1032c5341
42 changed files with 225 additions and 391 deletions

View file

@ -3,7 +3,6 @@ use crate::{
static_collab_panel_channels, static_collab_panel_current_call, v_stack, Icon, List,
ListHeader, ToggleState,
};
use gpui2::{img, svg, SharedString};
use std::marker::PhantomData;
#[derive(Element)]
@ -21,19 +20,19 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {
}
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let color = ThemeColor::new(cx);
let theme = theme(cx);
v_stack()
.id(self.id.clone())
.h_full()
.bg(color.surface)
.bg(theme.surface)
.child(
v_stack()
.id("crdb")
.w_full()
.overflow_y_scroll()
.child(
div().pb_1().border_color(color.border).border_b().child(
div().pb_1().border_color(theme.border).border_b().child(
List::new(static_collab_panel_current_call())
.header(
ListHeader::new("CRDB")
@ -77,79 +76,17 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {
.h_7()
.px_2()
.border_t()
.border_color(color.border)
.border_color(theme.border)
.flex()
.items_center()
.child(
div()
.text_sm()
.text_color(color.text_placeholder)
.text_color(theme.text_placeholder)
.child("Find..."),
),
)
}
fn list_section_header(
&self,
label: impl Into<SharedString>,
expanded: bool,
cx: &WindowContext,
) -> impl Element<ViewState = S> {
let color = ThemeColor::new(cx);
div()
.h_7()
.px_2()
.flex()
.justify_between()
.items_center()
.child(div().flex().gap_1().text_sm().child(label.into()))
.child(
div().flex().h_full().gap_1().items_center().child(
svg()
.path(if expanded {
"icons/caret_down.svg"
} else {
"icons/caret_up.svg"
})
.w_3p5()
.h_3p5()
.text_color(color.icon_muted),
),
)
}
fn list_item(
&self,
avatar_uri: impl Into<SharedString>,
label: impl Into<SharedString>,
cx: &WindowContext,
) -> impl Element<ViewState = S> {
let color = ThemeColor::new(cx);
div()
.id("list_item")
.h_7()
.px_2()
.flex()
.items_center()
.hover(|style| style.bg(color.ghost_element_hover))
.active(|style| style.bg(color.ghost_element_active))
.child(
div()
.flex()
.items_center()
.gap_1()
.text_sm()
.child(
img()
.uri(avatar_uri)
.size_3p5()
.rounded_full()
.bg(color.image_fallback_background),
)
.child(label.into()),
)
}
}
#[cfg(feature = "stories")]