some new stuff

This commit is contained in:
2024-10-17 20:17:35 +02:00
parent 63a864061b
commit 44a227780b
7 changed files with 231 additions and 76 deletions
+12 -24
View File
@@ -1,34 +1,22 @@
use osui::{
components::{div, text},
oml, Component, Params, Screen,
components::{button, div},
oml, App, Component, Params, UpdateResponse,
};
fn main() {
let mut screen = Screen::new();
screen.set_component(oml!(app()));
screen.run();
let mut app = App::new();
app.set_component(oml!(app_elem()));
app.run();
}
fn app(_: Params) -> Component {
fn app_elem(_: Params) -> Component {
oml!(
// Components (C)
div (width = 5, height = 3) {
text("Hello, World! daddy"; width = 30)
// // Props, With components (PC)
// div () {
// // Props (P)
// text(/* Properties go here, Example: x = 20 y = 5 */)
// }
// // Expression (E)
// text("Hello";)
// // Expression, With components (EC)
// text("World!";) {
// // Components in here
// }
div {
button("click me"; on_click = |c| {
c.response = UpdateResponse::SetComponent(
oml!(button("Clicked!";))
);
})
}
)
}