Repository navigation
Expand file tree
/
Copy pathhand_written.rs
More file actions
165 lines (163 loc) · 6.17 KB
/
Copy pathhand_written.rs
File metadata and controls
165 lines (163 loc) · 6.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
//! The "Team Inbox" card, hand-written the way GPUI code is typically
//! written today: chained builders, `rgb()` color constructors (converted to
//! Hsla at runtime, every build), explicit flex setup.
//!
//! `src/dsl.rs` renders the identical UI with the `ui!` macro — diff the two
//! files to see the code difference the macro buys.
use crate::data::Item;
use gpui::prelude::*;
use gpui::{FontWeight, IntoElement, div, px, rgb};
pub fn view(items: &[Item]) -> impl IntoElement {
div()
.flex()
.flex_col()
.gap(px(12.))
.p(px(16.))
.bg(rgb(0x1c1a17))
.rounded_xl()
.border(px(1.))
.border_color(rgb(0x2d2b27))
.w_full()
.child(
div()
.flex()
.flex_row()
.items_center()
.justify_between()
.child(
div()
.flex()
.flex_col()
.gap(px(2.))
.child(
div()
.text_lg()
.font_weight(FontWeight::SEMIBOLD)
.text_color(rgb(0xf5f0e8))
.child("Team Inbox"),
)
.child(
div()
.text_xs()
.text_color(rgb(0x8a857c))
.child("realtime presence"),
),
)
.child(
div()
.text_xs()
.font_weight(FontWeight::BOLD)
.text_color(rgb(0x9ece6a))
.bg(rgb(0x1e2a1e))
.px(px(8.))
.py(px(2.))
.rounded_full()
.child("LIVE"),
),
)
.child(div().h(px(1.)).w_full().bg(rgb(0x2d2b27)))
.child(
div()
.flex()
.flex_col()
.gap(px(8.))
.children(items.iter().map(|item| {
div()
.flex()
.flex_row()
.gap(px(12.))
.px(px(12.))
.py(px(8.))
.rounded_md()
.bg(rgb(0x24211d))
.border(px(1.))
.border_color(rgb(0x2d2b27))
.items_center()
.child(div().size(px(32.)).rounded_md().bg(rgb(item.accent)))
.child(
div()
.flex()
.flex_col()
.flex_1()
.gap(px(2.))
.child(
div()
.text_sm()
.font_weight(FontWeight::SEMIBOLD)
.text_color(rgb(0xf5f0e8))
.child(item.name.clone()),
)
.child(
div()
.text_xs()
.text_color(rgb(0x8a857c))
.child(item.role.clone()),
),
)
.child(if item.active {
div()
.text_xs()
.font_weight(FontWeight::SEMIBOLD)
.text_color(rgb(0x9ece6a))
.bg(rgb(0x1e2a1e))
.px(px(8.))
.py(px(2.))
.rounded_full()
.child("ACTIVE")
} else {
div()
.text_xs()
.text_color(rgb(0x8a857c))
.bg(rgb(0x262320))
.px(px(8.))
.py(px(2.))
.rounded_full()
.child("IDLE")
})
})),
)
.child(
div()
.flex()
.flex_row()
.items_center()
.justify_between()
.pt(px(8.))
.child(
div()
.text_xs()
.text_color(rgb(0x8a857c))
.child(format!("{} members", items.len())),
)
.child(
div()
.flex()
.flex_row()
.gap(px(8.))
.child(
div()
.text_xs()
.font_weight(FontWeight::SEMIBOLD)
.text_color(rgb(0x1c1a17))
.bg(rgb(0xe0b184))
.px(px(12.))
.py(px(4.))
.rounded_md()
.cursor_pointer()
.child("Invite"),
)
.child(
div()
.text_xs()
.text_color(rgb(0xf5f0e8))
.border(px(1.))
.border_color(rgb(0x2d2b27))
.px(px(12.))
.py(px(4.))
.rounded_md()
.cursor_pointer()
.child("Settings"),
),
),
)
}