Checkpoint

This commit is contained in:
Nathan Sobo 2023-08-19 22:33:28 -06:00
parent afff46b335
commit 6663d3f8eb
7 changed files with 350 additions and 367 deletions

View file

@ -1,17 +1,8 @@
#![allow(dead_code, unused_variables)]
use color::black;
use components::button;
use element::{Element, ParentElement};
use frame::frame;
use gpui::{
geometry::{rect::RectF, vector::vec2f},
platform::WindowOptions,
};
use log::LevelFilter;
use simplelog::SimpleLogger;
use themes::{rose_pine, ThemeColors};
use view::view;
use themes::ThemeColors;
mod adapter;
mod color;
@ -31,31 +22,32 @@ fn main() {
SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger");
gpui::App::new(()).unwrap().run(|cx| {
cx.add_window(
WindowOptions {
bounds: gpui::platform::WindowBounds::Fixed(RectF::new(
vec2f(0., 0.),
vec2f(400., 300.),
)),
center: true,
..Default::default()
},
|_| view(|_| playground(&rose_pine::moon())),
);
// cx.add_window(
// WindowOptions {
// bounds: gpui::platform::WindowBounds::Fixed(RectF::new(
// vec2f(0., 0.),
// vec2f(400., 300.),
// )),
// center: true,
// ..Default::default()
// },
// |_| view(|_| playground(&rose_pine::moon())),
// );
cx.platform().activate(true);
});
}
fn playground<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
frame()
.text_color(black())
.h_full()
.w_half()
.fill(theme.success(0.5))
.hover()
.fill(theme.error(0.5))
.child(button().label("Hello").click(|_, _, _| println!("click!")))
}
// fn playground<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
// todo!()
// // frame()
// // .text_color(black())
// // .h_full()
// // .w_half()
// // .fill(theme.success(0.5))
// // .hover()
// // .fill(theme.error(0.5))
// // .child(button().label("Hello").click(|_, _, _| println!("click!")))
// }
// todo!()
// // column()