awesome: arbitrary expressions excepted without braces

This commit is contained in:
Jonathan Kelley committed 2021-12-30 03:14:47 -05:00
1 parent 14961023f9
commit 4c85bcfdc8
40 files changed
+825 -767

No files matched your search

+11 -13
View File
@@ -14,20 +14,18 @@ fn main() {
pub static App: Component = |cx| {
let state = use_state(&cx, PlayerState::new);
let is_playing = state.is_playing();
rsx!(cx, div {
h1 {"Select an option"}
h3 {"The radio is... {is_playing}!"}
button {
"Pause"
onclick: move |_| state.modify().reduce(PlayerAction::Pause)
cx.render(rsx!(
div {
h1 {"Select an option"}
h3 { "The radio is... " [state.is_playing()], "!" }
button { onclick: move |_| state.modify().reduce(PlayerAction::Pause),
"Pause"
}
button { onclick: move |_| state.modify().reduce(PlayerAction::Play),
"Play"
}
}
button {
"Play"
onclick: move |_| state.modify().reduce(PlayerAction::Play)
}
})
))
};
enum PlayerAction {