1use gpui::*;
2
3struct HelloWorld {
4 text: SharedString,
5}
6
7impl Render for HelloWorld {
8 fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
9 div()
10 .flex()
11 .bg(rgb(0x2e7d32))
12 .size(Length::Definite(Pixels(300.0).into()))
13 .justify_center()
14 .items_center()
15 .shadow_lg()
16 .border()
17 .border_color(rgb(0x0000ff))
18 .text_xl()
19 .text_color(rgb(0xffffff))
20 .child(format!("Hello, {}!", &self.text))
21 }
22}
23
24fn main() {
25 App::new().run(|cx: &mut AppContext| {
26 let options = WindowOptions {
27 bounds: WindowBounds::Fixed(Bounds {
28 size: size(px(600.0), px(600.0)).into(),
29 origin: Default::default(),
30 }),
31 center: true,
32 ..Default::default()
33 };
34 cx.open_window(options, |cx| {
35 cx.new_view(|_cx| HelloWorld {
36 text: "World".into(),
37 })
38 });
39 });
40}