1use gpui2::elements::div;
2use gpui2::style::StyleHelpers;
3use gpui2::{Element, Hsla, IntoElement, ParentElement, ViewContext};
4
5use crate::theme;
6
7#[derive(Element)]
8pub struct TrafficLights {}
9
10pub fn traffic_lights() -> TrafficLights {
11 TrafficLights {}
12}
13
14impl TrafficLights {
15 fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
16 let theme = theme(cx);
17
18 div()
19 .flex()
20 .items_center()
21 .gap_2()
22 .child(traffic_light(theme.lowest.negative.default.foreground))
23 .child(traffic_light(theme.lowest.warning.default.foreground))
24 .child(traffic_light(theme.lowest.positive.default.foreground))
25 }
26}
27
28fn traffic_light<V: 'static, C: Into<Hsla>>(fill: C) -> div::Div<V> {
29 div().w_3().h_3().rounded_full().fill(fill.into())
30}