1use ui::prelude::*;
2
3#[derive(IntoElement)]
4pub struct ProfileModalHeader {
5 label: SharedString,
6 icon: IconName,
7}
8
9impl ProfileModalHeader {
10 pub fn new(label: impl Into<SharedString>, icon: IconName) -> Self {
11 Self {
12 label: label.into(),
13 icon,
14 }
15 }
16}
17
18impl RenderOnce for ProfileModalHeader {
19 fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
20 h_flex()
21 .w_full()
22 .px(DynamicSpacing::Base12.rems(cx))
23 .pt(DynamicSpacing::Base08.rems(cx))
24 .pb(DynamicSpacing::Base04.rems(cx))
25 .rounded_t_sm()
26 .gap_1p5()
27 .child(Icon::new(self.icon).size(IconSize::XSmall))
28 .child(
29 h_flex().gap_1().overflow_x_hidden().child(
30 div()
31 .max_w_96()
32 .overflow_x_hidden()
33 .text_ellipsis()
34 .child(Headline::new(self.label).size(HeadlineSize::XSmall)),
35 ),
36 )
37 }
38}