playground.rs

 1#![allow(dead_code, unused_variables)]
 2use crate::{color::black, style::StyleHelpers};
 3use element::Element;
 4use gpui::{
 5    geometry::{rect::RectF, vector::vec2f},
 6    platform::WindowOptions,
 7};
 8use log::LevelFilter;
 9use simplelog::SimpleLogger;
10use themes::{rose_pine, ThemeColors};
11use view::view;
12
13mod adapter;
14mod color;
15mod components;
16mod div;
17mod element;
18mod hoverable;
19mod interactive;
20mod layout_context;
21mod paint_context;
22mod style;
23mod text;
24mod themes;
25mod view;
26
27fn main() {
28    SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger");
29
30    gpui::App::new(()).unwrap().run(|cx| {
31        cx.add_window(
32            WindowOptions {
33                bounds: gpui::platform::WindowBounds::Fixed(RectF::new(
34                    vec2f(0., 0.),
35                    vec2f(400., 300.),
36                )),
37                center: true,
38                ..Default::default()
39            },
40            |_| view(|_| playground(&rose_pine::moon())),
41        );
42        cx.platform().activate(true);
43    });
44}
45
46fn playground<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
47    use div::div;
48
49    div()
50        .text_color(black())
51        .h_full()
52        .w_1_2()
53        .fill(theme.success(0.5))
54    // .hover()
55    // .fill(theme.error(0.5))
56    // .child(button().label("Hello").click(|_, _, _| println!("click!")))
57}
58
59//     todo!()
60//     // column()
61//     // .size(auto())
62//     // .fill(theme.base(0.5))
63//     // .text_color(theme.text(0.5))
64//     // .child(title_bar(theme))
65//     // .child(stage(theme))
66//     // .child(status_bar(theme))
67// }
68
69// fn title_bar<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
70//     row()
71//         .fill(theme.base(0.2))
72//         .justify(0.)
73//         .width(auto())
74//         .child(text("Zed Playground"))
75// }
76
77// fn stage<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
78//     row().fill(theme.surface(0.9))
79// }
80
81// fn status_bar<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
82//     row().fill(theme.surface(0.1))
83// }