Merge branch 'main' into nate/bring-ui-crate-up-to-date

This commit is contained in:
Nate Butler 2023-09-21 23:47:17 -04:00
commit d14e4d41ea
6 changed files with 70 additions and 29 deletions

View file

@ -0,0 +1,30 @@
use gpui2::elements::div;
use gpui2::style::StyleHelpers;
use gpui2::{Element, Hsla, IntoElement, ParentElement, ViewContext};
use crate::theme;
#[derive(Element)]
pub struct TrafficLights {}
pub fn traffic_lights() -> TrafficLights {
TrafficLights {}
}
impl TrafficLights {
fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
let theme = theme(cx);
div()
.flex()
.items_center()
.gap_2()
.child(traffic_light(theme.lowest.negative.default.foreground))
.child(traffic_light(theme.lowest.warning.default.foreground))
.child(traffic_light(theme.lowest.positive.default.foreground))
}
}
fn traffic_light<V: 'static, C: Into<Hsla>>(fill: C) -> div::Div<V> {
div().w_3().h_3().rounded_full().fill(fill.into())
}