port examples to new events

This commit is contained in:
Evan Almloff committed 2023-09-01 15:38:55 -05:00
1 parent dee92b83be
commit df222c121a
25 files changed
+55 -41

No files matched your search

@@ -1,7 +1,7 @@
// todo remove deprecated
#![allow(non_snake_case, deprecated)]
use dioxus::events::{KeyCode, KeyboardEvent};
use dioxus::events::KeyboardEvent;
use dioxus::prelude::*;
use dioxus_tui::TuiContext;
@@ -26,7 +26,7 @@ fn App(cx: Scope) -> Element {
background_color: "red",
justify_content: "center",
align_items: "center",
onkeydown: move |k: KeyboardEvent| if let KeyCode::Q = k.key_code {
onkeydown: move |k: KeyboardEvent| if let Code::KeyQ = k.code() {
tui_ctx.quit();
},
+1 -1
View File
@@ -14,7 +14,7 @@ fn App(cx: Scope) -> Element {
// we tell the component what to render
value: "{name}",
// and what to do when the value changes
oninput: move |evt| name.set(evt.value.clone()),
oninput: move |evt| name.set(evt.value()),
}
})
}
+1 -1
View File
@@ -28,7 +28,7 @@ fn MemeEditor(cx: Scope) -> Element {
},
CaptionEditor {
caption: caption,
on_input: move |event: FormEvent| {caption.set(event.value.clone());},
on_input: move |event: FormEvent| {caption.set(event.value());},
},
}
})
+2 -2
View File
@@ -62,7 +62,7 @@ pub fn DarkModeToggle(cx: Scope) -> Element {
input {
r#type: "checkbox",
oninput: move |event| {
let is_enabled = event.value == "true";
let is_enabled = event.value() == "true";
dark_mode.write().0 = is_enabled;
},
},
@@ -97,7 +97,7 @@ fn MemeEditor(cx: Scope) -> Element {
},
CaptionEditor {
caption: caption,
on_input: move |event: FormEvent| {caption.set(event.value.clone());},
on_input: move |event: FormEvent| {caption.set(event.value().clone());},
},
}
})
+2 -2
View File
@@ -40,7 +40,7 @@ cx.render(rsx!(
},
input {
value: "{comment_field}",
oninput: |event| comment_field.set(event.value.clone()),
oninput: |event| comment_field.set(event.value()),
}
input {
r#type: "submit",
@@ -71,7 +71,7 @@ cx.render(rsx!(
},
input {
value: "{comment_field}",
oninput: |event| comment_field.set(event.value.clone()),
oninput: |event| comment_field.set(event.value()),
}
input {
r#type: "submit",