context_pill.rs

 1use ui::prelude::*;
 2
 3use crate::context::Context;
 4
 5#[derive(IntoElement)]
 6pub struct ContextPill {
 7    context: Context,
 8}
 9
10impl ContextPill {
11    pub fn new(context: Context) -> Self {
12        Self { context }
13    }
14}
15
16impl RenderOnce for ContextPill {
17    fn render(self, cx: &mut WindowContext) -> impl IntoElement {
18        div()
19            .px_1()
20            .border_1()
21            .border_color(cx.theme().colors().border)
22            .rounded_md()
23            .child(Label::new(self.context.name.clone()).size(LabelSize::Small))
24    }
25}