mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-17 06:08:26 +00:00
* add new autofmt sample * Feat: implement rustfmt::skip support for rsx * generally improve error handling with better expect messages * wip: nested rsx formatting and expression formatting * nested rsx formatting works * collapse autofmt crate * cast indent through macros * use proper whitespace * no more eating comments! * Use proper error handling
45 lines
1.3 KiB
R
45 lines
1.3 KiB
R
fn main() {
|
|
rsx! {
|
|
div {
|
|
{
|
|
let millis = timer
|
|
.with(|t| {
|
|
t
|
|
.duration()
|
|
.saturating_sub(
|
|
t.started_at.map(|x| x.elapsed()).unwrap_or(Duration::ZERO),
|
|
)
|
|
.as_millis()
|
|
});
|
|
format!(
|
|
"{:02}:{:02}:{:02}.{:01}",
|
|
millis / 1000 / 3600 % 3600,
|
|
millis / 1000 / 60 % 60,
|
|
millis / 1000 % 60,
|
|
millis / 100 % 10,
|
|
)
|
|
}
|
|
}
|
|
div {
|
|
input {
|
|
r#type: "number",
|
|
min: 0,
|
|
max: 99,
|
|
value: format!("{:02}", timer.read().hours),
|
|
oninput: move |e| {
|
|
timer.write().hours = e.value().parse().unwrap_or(0);
|
|
},
|
|
}
|
|
// some comment
|
|
input {
|
|
r#type: "number",
|
|
min: 0,
|
|
max: 99,
|
|
value: format!("{:02}", timer.read().hours),
|
|
oninput: move |e| {
|
|
timer.write().hours = e.value().parse().unwrap_or(0);
|
|
},
|
|
}
|
|
}
|
|
}
|
|
}
|