Merge branch 'main' into nate/bring-ui-crate-up-to-date
This commit is contained in:
commit
d14e4d41ea
6 changed files with 70 additions and 29 deletions
|
@ -4,6 +4,7 @@ mod list_item;
|
|||
mod list_section_header;
|
||||
mod palette_item;
|
||||
mod tab;
|
||||
mod traffic_lights;
|
||||
|
||||
pub use facepile::*;
|
||||
pub use follow_group::*;
|
||||
|
@ -11,6 +12,7 @@ pub use list_item::*;
|
|||
pub use list_section_header::*;
|
||||
pub use palette_item::*;
|
||||
pub use tab::*;
|
||||
pub use traffic_lights::*;
|
||||
|
||||
use std::marker::PhantomData;
|
||||
use std::rc::Rc;
|
||||
|
|
30
crates/ui/src/components/traffic_lights.rs
Normal file
30
crates/ui/src/components/traffic_lights.rs
Normal 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())
|
||||
}
|
|
@ -5,7 +5,7 @@ use gpui2::style::StyleHelpers;
|
|||
use gpui2::{Element, IntoElement, ParentElement, ViewContext};
|
||||
|
||||
use crate::prelude::Shape;
|
||||
use crate::{avatar, follow_group, icon_button, text_button, theme, tool_divider};
|
||||
use crate::{avatar, follow_group, icon_button, text_button, theme, tool_divider, traffic_lights};
|
||||
|
||||
#[derive(Element)]
|
||||
pub struct TitleBar<V: 'static> {
|
||||
|
@ -40,34 +40,7 @@ impl<V: 'static> TitleBar<V> {
|
|||
.h_full()
|
||||
.gap_4()
|
||||
.px_2()
|
||||
// === Traffic Lights === //
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_2()
|
||||
.child(
|
||||
div()
|
||||
.w_3()
|
||||
.h_3()
|
||||
.rounded_full()
|
||||
.fill(theme.lowest.positive.default.foreground),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.w_3()
|
||||
.h_3()
|
||||
.rounded_full()
|
||||
.fill(theme.lowest.warning.default.foreground),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.w_3()
|
||||
.h_3()
|
||||
.rounded_full()
|
||||
.fill(theme.lowest.negative.default.foreground),
|
||||
),
|
||||
)
|
||||
.child(traffic_lights())
|
||||
// === Project Info === //
|
||||
.child(
|
||||
div()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue