some new stuff
This commit is contained in:
+12
-24
@@ -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!";))
|
||||
);
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user