1use gpui2::elements::div;
2use gpui2::style::StyleHelpers;
3use gpui2::{Element, IntoElement, ParentElement, ViewContext};
4
5use crate::theme;
6
7#[derive(Element, Clone)]
8pub struct Details {
9 text: &'static str,
10 meta: Option<&'static str>,
11}
12
13pub fn details(text: &'static str) -> Details {
14 Details { text, meta: None }
15}
16
17impl Details {
18 pub fn meta_text(mut self, meta: &'static str) -> Self {
19 self.meta = Some(meta);
20 self
21 }
22
23 fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
24 let theme = theme(cx);
25
26 div()
27 // .flex()
28 // .w_full()
29 .p_1()
30 .gap_0p5()
31 .text_xs()
32 .text_color(theme.lowest.base.default.foreground)
33 .child(self.text.clone())
34 .children(self.meta.map(|m| m))
35 }
36}