use crate::t3::press::rem;
use crate::{icons::CarbonIcon, theme::color, tokens::ColorRole};
use gpui_kit::{
AnyElement, BoxShadow, Div, FontWeight, Hsla, IntoElement, ParentElement, SharedString, Styled,
div, prelude::FluentBuilder as _, px,
};
pub(crate) fn rail(c: Hsla) -> Vec<BoxShadow> {
vec![BoxShadow::new(px(3.), px(0.), c).inset()]
}
pub(crate) fn frame() -> Div {
div()
.relative()
.flex()
.flex_col()
.w_full()
.min_w_0()
.gap(rem(12.))
.p(rem(16.))
.bg(color(ColorRole::Layer01))
.text_color(color(ColorRole::TextPrimary))
}
pub(crate) fn head() -> Div {
div()
.flex()
.flex_row()
.items_center()
.min_w_0()
.gap(rem(8.))
.text_size(rem(14.))
.line_height(rem(18.))
}
pub(crate) fn head_icon(icon: CarbonIcon, ink: Hsla) -> AnyElement {
crate::t3::press::icon(icon, 16., ink).into_any_element()
}
pub(crate) fn head_title(text: impl Into<SharedString>) -> Div {
div()
.min_w_0()
.overflow_hidden()
.text_ellipsis()
.whitespace_nowrap()
.font_weight(FontWeight::SEMIBOLD)
.child(text.into())
}
pub(crate) fn sub(text: impl Into<SharedString>) -> Div {
div()
.flex_none()
.text_size(rem(12.))
.line_height(rem(16.))
.text_color(color(ColorRole::TextSecondary))
.child(text.into())
}
pub(crate) fn label(text: impl Into<SharedString>) -> Div {
div()
.text_size(rem(12.))
.line_height(rem(16.))
.mb(rem(-8.))
.text_color(color(ColorRole::TextSecondary))
.child(text.into())
}
pub(crate) fn note(text: impl Into<SharedString>) -> Div {
div()
.text_size(rem(14.))
.line_height(rem(20.))
.text_color(color(ColorRole::TextSecondary))
.child(text.into())
}
pub(crate) fn actions() -> Div {
div()
.flex()
.flex_row()
.flex_wrap()
.justify_end()
.items_center()
.gap(rem(8.))
}
pub(crate) fn grow() -> Div {
div().flex_1()
}
pub(crate) fn framed(rail_color: Option<Hsla>) -> Div {
frame().when_some(rail_color, |this, c| this.shadow(rail(c)))
}