Update assistant header
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use gpui::{Div, IntoElement};
|
||||
use gpui::{Div, Hsla, IntoElement};
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
@@ -7,9 +7,26 @@ enum DividerDirection {
|
||||
Vertical,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum DividerColor {
|
||||
Border,
|
||||
#[default]
|
||||
BorderVariant,
|
||||
}
|
||||
|
||||
impl DividerColor {
|
||||
pub fn hsla(self, cx: &WindowContext) -> Hsla {
|
||||
match self {
|
||||
DividerColor::Border => cx.theme().colors().border,
|
||||
DividerColor::BorderVariant => cx.theme().colors().border_variant,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub struct Divider {
|
||||
direction: DividerDirection,
|
||||
color: DividerColor,
|
||||
inset: bool,
|
||||
}
|
||||
|
||||
@@ -26,7 +43,7 @@ impl RenderOnce for Divider {
|
||||
this.w_px().h_full().when(self.inset, |this| this.my_1p5())
|
||||
}
|
||||
})
|
||||
.bg(cx.theme().colors().border_variant)
|
||||
.bg(self.color.hsla(cx))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +51,7 @@ impl Divider {
|
||||
pub fn horizontal() -> Self {
|
||||
Self {
|
||||
direction: DividerDirection::Horizontal,
|
||||
color: DividerColor::default(),
|
||||
inset: false,
|
||||
}
|
||||
}
|
||||
@@ -41,6 +59,7 @@ impl Divider {
|
||||
pub fn vertical() -> Self {
|
||||
Self {
|
||||
direction: DividerDirection::Vertical,
|
||||
color: DividerColor::default(),
|
||||
inset: false,
|
||||
}
|
||||
}
|
||||
@@ -49,4 +68,9 @@ impl Divider {
|
||||
self.inset = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn color(mut self, color: DividerColor) -> Self {
|
||||
self.color = color;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ 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 {
|
||||
@@ -94,8 +96,6 @@ impl RenderOnce for Tab {
|
||||
type Rendered = Stateful<Div>;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
const HEIGHT_IN_REMS: f32 = 30. / 16.;
|
||||
|
||||
let (text_color, tab_bg, _tab_hover_bg, _tab_active_bg) = match self.selected {
|
||||
false => (
|
||||
cx.theme().colors().text_muted,
|
||||
@@ -112,7 +112,7 @@ impl RenderOnce for Tab {
|
||||
};
|
||||
|
||||
self.div
|
||||
.h(rems(HEIGHT_IN_REMS))
|
||||
.h(rems(TAB_HEIGHT_IN_REMS))
|
||||
.bg(tab_bg)
|
||||
.border_color(cx.theme().colors().border)
|
||||
.map(|this| match self.position {
|
||||
|
||||
Reference in New Issue
Block a user