From 606d153e9a5a16917fe867f5631f0f0949587c82 Mon Sep 17 00:00:00 2001 From: Xu Shaohua Date: Fri, 24 Nov 2023 17:17:13 +0800 Subject: [PATCH] docs: Add on change handles to Checkbox page --- .../zu-docs/src/views/inputs/checkbox_page.rs | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/crates/zu-docs/src/views/inputs/checkbox_page.rs b/crates/zu-docs/src/views/inputs/checkbox_page.rs index 4834aee3b..9f70534bd 100644 --- a/crates/zu-docs/src/views/inputs/checkbox_page.rs +++ b/crates/zu-docs/src/views/inputs/checkbox_page.rs @@ -156,6 +156,22 @@ fn form_group_section() -> Html { let antoine = use_state(|| true); let error = use_state(|| false); + let gilad_changed = { + let gilad_clone = gilad.clone(); + Callback::from(move |checked: bool| { + gilad_clone.set(checked); + log::info!("gilad old state: {}, new state: {checked}", *gilad_clone); + }) + }; + let jason_changed = { + let jason_clone = jason.clone(); + Callback::from(move |checked: bool| jason_clone.set(checked)) + }; + let antoine_changed = { + let antoine_clone = antoine.clone(); + Callback::from(move |checked: bool| antoine_clone.set(checked)) + }; + html! { <>

{"FormGroup"}

@@ -170,19 +186,28 @@ fn form_group_section() -> Html { + }} label="Gilad Gray" /> + }} label="Jason Killian" /> + }} label="Antoine Llorca" /> @@ -199,19 +224,28 @@ fn form_group_section() -> Html { + }} label="Gilad Gray" /> + }} label="Jason Killian" /> + }} label="Antoine Llorca" />