main
Elnu 10 months ago
parent d29f3aabca
commit 81d2626a35

@ -1,5 +1,5 @@
pub mod svg;
mod render;
pub mod svg;
use sycamore::prelude::*;
@ -13,13 +13,18 @@ fn Slider<G: Html>(cx: Scope) -> View<G> {
}
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()
});
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()
},
);
}

@ -31,7 +31,10 @@ mod filters {
use crate::svg::{SVGMeasure, SVGUnit};
pub fn kle_font_units(kle_font_units: &usize) -> askama::Result<SVGMeasure> {
Ok(SVGMeasure::new((6 + kle_font_units * 2) as f64, SVGUnit::Pixel))
Ok(SVGMeasure::new(
(6 + kle_font_units * 2) as f64,
SVGUnit::Pixel,
))
}
}
@ -45,8 +48,14 @@ pub enum Error {
pub type Result<T> = std::result::Result<T, Error>;
pub fn render_file<P, Q>(input_path: P, output_path: Q) -> Result<()>
where P: AsRef<Path>, Q: AsRef<Path> {
use std::{fs::{self, OpenOptions}, io::Write};
where
P: AsRef<Path>,
Q: AsRef<Path>,
{
use std::{
fs::{self, OpenOptions},
io::Write,
};
let mut file = OpenOptions::new()
.write(true)
.truncate(true)
@ -62,4 +71,4 @@ pub fn render(input: &str) -> Result<String> {
keyboard: serde_json::from_str(input)?,
};
Ok(document.render()?)
}
}

Loading…
Cancel
Save