generated from ElnuDev/rust-project
Sycamore demo
This commit is contained in:
parent
a4f513703f
commit
d29f3aabca
9 changed files with 492 additions and 9 deletions
3
dyesub-tool/.gitignore
vendored
Normal file
3
dyesub-tool/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
layout.json
|
||||
output.svg
|
||||
dist
|
|
@ -12,3 +12,5 @@ regex = "1.9.3"
|
|||
serde_json = "1.0.105"
|
||||
strum = "0.25.0"
|
||||
strum_macros = "0.25.2"
|
||||
sycamore = "0.9.0-beta.1"
|
||||
web-sys = "0.3.64"
|
||||
|
|
14
dyesub-tool/index.html
Normal file
14
dyesub-tool/index.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>dyesub-tool</title>
|
||||
<link data-trunk rel="css" href="missing.min.css"> <!-- 1.0.9 -->
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
126
dyesub-tool/missing.min.css
vendored
Normal file
126
dyesub-tool/missing.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,10 +1,25 @@
|
|||
pub mod svg;
|
||||
|
||||
mod render;
|
||||
|
||||
use render::{render_file, Result};
|
||||
use sycamore::prelude::*;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
render_file("layout.json", "output.svg")?;
|
||||
Ok(())
|
||||
#[component]
|
||||
fn Slider<G: Html>(cx: Scope) -> View<G> {
|
||||
let value = create_signal(cx, 0.0);
|
||||
view! { cx,
|
||||
(value.get())
|
||||
input(type="range", bind:valueAsNumber=value)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
sycamore::render_to(|cx| view! { cx,
|
||||
Slider
|
||||
Slider
|
||||
Slider
|
||||
}, {
|
||||
let window = web_sys::window().unwrap();
|
||||
let document = window.document().unwrap();
|
||||
&document.query_selector("main").unwrap().unwrap()
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue