1use std::marker::PhantomData;
2
3use gpui2::elements::div;
4use gpui2::style::StyleHelpers;
5use gpui2::{Element, IntoElement, ParentElement, ViewContext};
6
7use crate::prelude::Shape;
8use crate::{avatar, follow_group, icon_button, text_button, theme, tool_divider, traffic_lights};
9
10#[derive(Element)]
11pub struct TitleBar<V: 'static> {
12 view_type: PhantomData<V>,
13}
14
15pub fn title_bar<V: 'static>() -> TitleBar<V> {
16 TitleBar {
17 view_type: PhantomData,
18 }
19}
20
21impl<V: 'static> TitleBar<V> {
22 fn render(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
23 let theme = theme(cx);
24 let player_list = vec![
25 avatar("https://avatars.githubusercontent.com/u/1714999?v=4"),
26 avatar("https://avatars.githubusercontent.com/u/1714999?v=4"),
27 ];
28
29 div()
30 .flex()
31 .items_center()
32 .justify_between()
33 .w_full()
34 .h_8()
35 .fill(theme.lowest.base.default.background)
36 .child(
37 div()
38 .flex()
39 .items_center()
40 .h_full()
41 .gap_4()
42 .px_2()
43 .child(traffic_lights())
44 // === Project Info === //
45 .child(
46 div()
47 .flex()
48 .items_center()
49 .gap_1()
50 .child(text_button("maxbrunsfeld"))
51 .child(text_button("zed"))
52 .child(text_button("nate/gpui2-ui-components")),
53 )
54 .child(follow_group(player_list.clone()).player(0))
55 .child(follow_group(player_list.clone()).player(1))
56 .child(follow_group(player_list.clone()).player(2)),
57 )
58 .child(
59 div()
60 .flex()
61 .items_center()
62 .child(
63 div()
64 .px_2()
65 .flex()
66 .items_center()
67 .gap_1()
68 .child(icon_button("icons/stop_sharing.svg"))
69 .child(icon_button("icons/exit.svg")),
70 )
71 .child(tool_divider())
72 .child(
73 div()
74 .px_2()
75 .flex()
76 .items_center()
77 .gap_1()
78 .child(icon_button("icons/mic.svg"))
79 .child(icon_button("icons/speaker-loud.svg"))
80 .child(icon_button("icons/desktop.svg")),
81 )
82 .child(
83 div().px_2().flex().items_center().child(
84 avatar("https://avatars.githubusercontent.com/u/1714999?v=4")
85 .shape(Shape::RoundedRectangle),
86 ),
87 ),
88 )
89 }
90}