1use gpui::{prelude::*, AnyElement};
2use smallvec::SmallVec;
3use ui::prelude::*;
4
5#[derive(IntoElement)]
6pub struct ExtensionCard {
7 children: SmallVec<[AnyElement; 2]>,
8}
9
10impl ExtensionCard {
11 pub fn new() -> Self {
12 Self {
13 children: SmallVec::new(),
14 }
15 }
16}
17
18impl ParentElement for ExtensionCard {
19 fn extend(&mut self, elements: impl Iterator<Item = AnyElement>) {
20 self.children.extend(elements)
21 }
22}
23
24impl RenderOnce for ExtensionCard {
25 fn render(self, cx: &mut WindowContext) -> impl IntoElement {
26 div().w_full().child(
27 v_flex()
28 .w_full()
29 .h(rems(7.))
30 .p_3()
31 .mt_4()
32 .gap_2()
33 .bg(cx.theme().colors().elevated_surface_background)
34 .border_1()
35 .border_color(cx.theme().colors().border)
36 .rounded_md()
37 .children(self.children),
38 )
39 }
40}