@@ -6,12 +6,26 @@ use log::debug;
66use web_sys:: { EventTarget , HtmlElement , HtmlInputElement as InputElement , UiEvent } ;
77
88use kobold:: branching:: Branch7 ;
9+ use kobold:: event:: Listener ;
910use kobold:: prelude:: * ;
1011
1112use crate :: components:: QRForTask :: QRForTask ;
1213use crate :: js;
1314use crate :: state:: { Editing , State , Text } ;
1415
16+ #[ component]
17+ pub fn ButtonAddRow (
18+ row : usize ,
19+ // onadd_row_fn: F
20+ ) -> impl View {
21+ view ! {
22+ <button. add
23+ data={ row}
24+ // onclick={onadd_row_fn}
25+ />
26+ }
27+ }
28+
1529#[ component]
1630pub fn Cell ( col : usize , row : usize , state : & Hook < State > ) -> impl View + ' _ {
1731 // debug!("Cell get_text source {:?} {:?}", col, row);
@@ -144,6 +158,10 @@ pub fn Cell(col: usize, row: usize, state: &Hook<State>) -> impl View + '_ {
144158 data={ row}
145159 onclick={ onadd_row}
146160 />
161+ <ButtonAddRow
162+ row={ row}
163+ // onadd_row_fn={onadd_row}
164+ />
147165 </td>
148166 <td. destroy-container>
149167 <button. destroy
@@ -163,29 +181,3 @@ pub fn Cell(col: usize, row: usize, state: &Hook<State>) -> impl View + '_ {
163181 }
164182 }
165183}
166-
167- // #[component(auto_branch)]
168- // pub fn AddRow(
169- // row: usize,
170- // onadd_row_fn: &dyn Fn(&mut State, MouseEvent<HtmlElement>)
171- // ) -> impl View {
172- // view! {
173- // <button.add
174- // data={row}
175- // onclick={onadd_row_fn}
176- // />
177- // }
178- // }
179-
180- // #[component(auto_branch)]
181- // pub fn DestroyRow(
182- // row: usize,
183- // ondestroy_row_fn: &dyn Fn(&mut State, MouseEvent<HtmlElement>)
184- // ) -> impl View {
185- // view! {
186- // <button.destroy
187- // data={row}
188- // onclick={ondestroy_row_fn}
189- // />
190- // }
191- // }
0 commit comments