small change in example

This commit is contained in:
2024-12-19 13:29:44 +01:00
parent e8bcb9a31f
commit d453d3aa70
+3 -7
View File
@@ -83,12 +83,6 @@ pub mod todo_example {
pub mod login_example { pub mod login_example {
use crate::prelude::*; use crate::prelude::*;
pub fn second_screen(usr: String, psw: String) -> Element {
rsx! {
text { "Username: {usr}\nPassword: {psw}" }
}
}
pub fn app() -> Element { pub fn app() -> Element {
rsx! { rsx! {
@SetStyle(styling()) @SetStyle(styling())
@@ -99,7 +93,9 @@ pub mod login_example {
}, "username: " } }, "username: " }
input { class: "input", id: "psw", on_click: fn(psw: &mut Input, _, document) { input { class: "input", id: "psw", on_click: fn(psw: &mut Input, _, document) {
if let Some(usr) = document.get_element_by_id::<Input>("usr") { if let Some(usr) = document.get_element_by_id::<Input>("usr") {
document.draw(second_screen(usr.text.clone(), psw.text.clone())); document.draw(rsx! {
text { static "Username: {}\nPassword: {}", usr.text, psw.text }
});
} }
}, "password: " } }, "password: " }
} }