better structure
This commit is contained in:
+31
-6
@@ -1,11 +1,36 @@
|
||||
use osui::{components::div, oml, Component, ComponentParams};
|
||||
use osui::{
|
||||
components::{div, text, Div},
|
||||
oml, ComponentParams,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let doc = oml!(
|
||||
(div) {
|
||||
(div) {}
|
||||
}
|
||||
);
|
||||
let some_text = app(ComponentParams {
|
||||
children: vec![],
|
||||
expr: "".to_string(),
|
||||
});
|
||||
let doc = oml!(div { some_text; });
|
||||
|
||||
println!("{:?}", doc);
|
||||
}
|
||||
|
||||
fn app(_: ComponentParams) -> Box<Div> {
|
||||
oml!(
|
||||
// Components (C)
|
||||
div {
|
||||
// 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
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user