From 9801e30e131f5ff4e2b9667177cd716b9861930e Mon Sep 17 00:00:00 2001 From: "S. Yakupov" Date: Wed, 2 Aug 2023 11:43:04 +0300 Subject: [PATCH] feat: tune NG `Label` and `Button` (#48) --- examples/ng_blur.rs | 4 ++- examples/ng_buttons.rs | 20 +++++++------- examples/ng_grid.rs | 56 ++++++++++++++++++-------------------- examples/ng_hello_world.rs | 4 +-- examples/ng_pointer.rs | 4 ++- examples/ng_rows_cols.rs | 16 +++++------ src/ng/button.rs | 42 ++++++++++++++-------------- src/ng/column.rs | 33 +++++++++++++++++----- src/ng/grid.rs | 30 ++++++++++++++------ src/ng/label.rs | 12 +++----- src/ng/row.rs | 33 +++++++++++++++++----- src/ng/slide.rs | 18 ++++++++++-- src/ng/slideshow.rs | 1 + src/ng/svg.rs | 6 +--- 14 files changed, 168 insertions(+), 111 deletions(-) diff --git a/examples/ng_blur.rs b/examples/ng_blur.rs index 5eb57bf..1f0fe06 100644 --- a/examples/ng_blur.rs +++ b/examples/ng_blur.rs @@ -8,7 +8,9 @@ pub fn Blur(cx: Scope) -> impl IntoView { view! { cx, - } } diff --git a/examples/ng_buttons.rs b/examples/ng_buttons.rs index 9debfba..1130f03 100644 --- a/examples/ng_buttons.rs +++ b/examples/ng_buttons.rs @@ -12,18 +12,18 @@ pub fn Buttons(cx: Scope) -> impl IntoView { view! { cx, - + + + + + + + + } diff --git a/examples/ng_grid.rs b/examples/ng_grid.rs index 311fe31..234db4e 100644 --- a/examples/ng_grid.rs +++ b/examples/ng_grid.rs @@ -6,45 +6,41 @@ pub fn GridExample(cx: Scope) -> impl IntoView { view! { cx, - diff --git a/examples/ng_hello_world.rs b/examples/ng_hello_world.rs index c308821..9818e1e 100644 --- a/examples/ng_hello_world.rs +++ b/examples/ng_hello_world.rs @@ -6,10 +6,10 @@ pub fn HelloWorld(cx: Scope) -> impl IntoView { view! { cx, - - } diff --git a/examples/ng_pointer.rs b/examples/ng_pointer.rs index b4abe7b..a913656 100644 --- a/examples/ng_pointer.rs +++ b/examples/ng_pointer.rs @@ -8,7 +8,9 @@ pub fn Pointer(cx: Scope) -> impl IntoView { view! { cx, - } } diff --git a/examples/ng_rows_cols.rs b/examples/ng_rows_cols.rs index 252f880..13889bc 100644 --- a/examples/ng_rows_cols.rs +++ b/examples/ng_rows_cols.rs @@ -6,16 +6,16 @@ pub fn RowsCols(cx: Scope) -> impl IntoView { view! { cx, - } diff --git a/src/ng/button.rs b/src/ng/button.rs index c4b6115..e76bf85 100644 --- a/src/ng/button.rs +++ b/src/ng/button.rs @@ -7,9 +7,8 @@ const WIDTH: i32 = 400; const HEIGHT: i32 = 150; #[component] -pub fn Button( +pub fn Button( cx: Scope, - text: F, on_click: CB, #[prop(optional)] text_bold: bool, #[prop(default = WIDTH)] width: i32, @@ -23,10 +22,9 @@ pub fn Button( #[prop(default = Color::RoyalBlue)] border_color: Color, #[prop(default = Align::Center)] align: Align, #[prop(default = VAlign::Middle)] valign: VAlign, + children: Children, ) -> impl IntoView where - F: Fn(Scope) -> IV + 'static, - IV: IntoView, CB: FnMut(MouseEvent) + 'static, { let f = use_frame(cx); @@ -67,22 +65,24 @@ where let on_mouseup = move |_| set_border.set(border_width); view! { cx, - -