indicator.rs

 1use crate::prelude::*;
 2use gpui::{px, Div, RenderOnce};
 3
 4#[derive(RenderOnce)]
 5pub struct UnreadIndicator;
 6
 7impl<V: 'static> Component<V> for UnreadIndicator {
 8    type Rendered = Div<V>;
 9
10    fn render(self, view: &mut V, cx: &mut ViewContext<V>) -> Self::Rendered {
11        div()
12            .rounded_full()
13            .border_2()
14            .border_color(cx.theme().colors().surface_background)
15            .w(px(9.0))
16            .h(px(9.0))
17            .z_index(2)
18            .bg(cx.theme().status().info)
19    }
20}
21
22impl UnreadIndicator {
23    pub fn new() -> Self {
24        Self
25    }
26
27    fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Element<V> {
28        div()
29            .rounded_full()
30            .border_2()
31            .border_color(cx.theme().colors().surface_background)
32            .w(px(9.0))
33            .h(px(9.0))
34            .z_index(2)
35            .bg(cx.theme().status().info)
36    }
37}