wip: it works more

This commit is contained in:
Jonathan Kelley committed 2022-11-15 23:59:19 -08:00
1 parent 9a3f84037e
commit ea7ab5f765
4 files changed
+20 -18

No files matched your search

+2 -2
View File
@@ -21,7 +21,7 @@ fn main() {
fn app(cx: Scope) -> Element { fn app(cx: Scope) -> Element {
let files = use_ref(&cx, Files::new); let files = use_ref(&cx, Files::new);
render! { cx.render(rsx! {
div { div {
link { href:"https://fonts.googleapis.com/icon?family=Material+Icons", rel:"stylesheet", } link { href:"https://fonts.googleapis.com/icon?family=Material+Icons", rel:"stylesheet", }
style { include_str!("./assets/fileexplorer.css") } style { include_str!("./assets/fileexplorer.css") }
@@ -62,7 +62,7 @@ fn app(cx: Scope) -> Element {
}) })
} }
} }
} })
} }
struct Files { struct Files {
-6
View File
@@ -17,12 +17,6 @@ fn app(cx: Scope) -> Element {
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_iter(), .into_iter(),
["x", "y", "z"]
.into_iter()
.map(|f| rsx! { "{f}" })
.collect::<Vec<_>>()
.into_iter(),
// Use optionals // Use optionals
Some(rsx! { "Some" }), Some(rsx! { "Some" }),
} }
+9 -6
View File
@@ -70,12 +70,15 @@ pub fn Die<'a>(cx: Scope<'a, DieProps<'a>>) -> Element {
.map(|((x, y), _)| { .map(|((x, y), _)| {
let dcx = x * OFFSET; let dcx = x * OFFSET;
let dcy = y * OFFSET; let dcy = y * OFFSET;
rsx!(circle {
cx: "{dcx}", rsx! {
cy: "{dcy}", circle {
r: "{DOT_RADIUS}", cx: "{dcx}",
fill: "#333" cy: "{dcy}",
}) r: "{DOT_RADIUS}",
fill: "#333"
}
}
}); });
cx.render(rsx! { cx.render(rsx! {
+9 -4
View File
@@ -220,7 +220,7 @@ impl VirtualDom {
path: &template.template.node_paths[idx][1..], path: &template.template.node_paths[idx][1..],
value, value,
}); });
1 0
} }
DynamicNode::Component { DynamicNode::Component {
@@ -296,10 +296,15 @@ impl VirtualDom {
.fold(0, |acc, child| acc + self.create(mutations, child)) .fold(0, |acc, child| acc + self.create(mutations, child))
} }
DynamicNode::Placeholder(_) => { DynamicNode::Placeholder(slot) => {
let id = self.next_element(template); let id = self.next_element(template);
mutations.push(CreatePlaceholder { id }); slot.set(id);
1 mutations.push(AssignId {
path: &template.template.node_paths[idx][1..],
id,
});
0
} }
} }
} }