Skip to main content

showcase/
showcase.rs

1use gpui::{
2    App, Application, Bounds, Context, Render, Window, WindowBounds, WindowOptions, div,
3    prelude::*, px, rgb, size,
4};
5use gpui_phosphor::{Icon, IconName, PhosphorAssets, Weight};
6
7struct Showcase;
8
9impl Render for Showcase {
10    fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
11        div()
12            .flex()
13            .gap_4()
14            .size_full()
15            .justify_center()
16            .items_center()
17            .bg(rgb(0x17171b))
18            .child(
19                Icon::new(IconName::Heart)
20                    .size(px(48.0))
21                    .color(rgb(0xf472b6)),
22            )
23            .child(
24                Icon::new(IconName::Star)
25                    .size(px(48.0))
26                    .color(rgb(0xfacc15)),
27            )
28            .child(
29                Icon::new(IconName::Rocket)
30                    .weight(Weight::Regular)
31                    .size(px(48.0))
32                    .color(rgb(0x60a5fa)),
33            )
34            .child(
35                Icon::new(IconName::Pulse)
36                    .size(px(48.0))
37                    .color(rgb(0x34d399)),
38            )
39    }
40}
41
42fn main() {
43    Application::new()
44        .with_assets(PhosphorAssets)
45        .run(|cx: &mut App| {
46            let bounds = Bounds::centered(None, size(px(460.0), px(180.0)), cx);
47            cx.open_window(
48                WindowOptions {
49                    window_bounds: Some(WindowBounds::Windowed(bounds)),
50                    ..Default::default()
51                },
52                |_, cx| cx.new(|_| Showcase),
53            )
54            .expect("failed to open the GPUI showcase window");
55            cx.activate(true);
56        });
57}