From e9778b6008c3e5bfa15e14d14322398cbe7e9d3c Mon Sep 17 00:00:00 2001 From: luoxiaozero <48741584+luoxiaozero@users.noreply.github.com> Date: Mon, 11 Dec 2023 15:44:22 +0800 Subject: [PATCH] Fix/ci nightly (#45) * demo: Modify button click * fix: ci run nightly * pref: fmt and clippy --- demo/src/components/site_header.rs | 2 +- demo/src/pages/button/mod.rs | 40 ++++++++---------------------- demo/src/pages/home.rs | 2 +- demo/src/pages/loading_bar/mod.rs | 12 ++++----- demo/src/pages/message/mod.rs | 12 ++++----- demo/src/pages/modal/mod.rs | 4 +-- demo/src/pages/time_picker/mod.rs | 6 +++-- demo/src/pages/toast/mod.rs | 2 +- src/auto_complete/mod.rs | 7 +++--- src/calendar/mod.rs | 7 +++--- src/color_picker/mod.rs | 5 ++-- src/message/message_provider.rs | 3 +-- src/slider/mod.rs | 5 ++-- src/time_picker/mod.rs | 27 ++++++++++++-------- src/typography/text.rs | 4 +-- 15 files changed, 61 insertions(+), 77 deletions(-) diff --git a/demo/src/components/site_header.rs b/demo/src/components/site_header.rs index b5b17f9..6039c4f 100644 --- a/demo/src/components/site_header.rs +++ b/demo/src/components/site_header.rs @@ -117,7 +117,7 @@ pub fn SiteHeader() -> impl IntoView { icon=icondata::AiIcon::AiGithubOutlined round=true style="font-size: 22px; padding: 0px 6px;" - on:click=move |_| { + on_click=move |_| { _ = window().open_with_url("http://github.com/thaw-ui/thaw"); } /> diff --git a/demo/src/pages/button/mod.rs b/demo/src/pages/button/mod.rs index dc4543a..25cddb6 100644 --- a/demo/src/pages/button/mod.rs +++ b/demo/src/pages/button/mod.rs @@ -136,18 +136,10 @@ pub fn ButtonPage() -> impl IntoView {

"Size"

- - - - + + + + @@ -177,26 +169,14 @@ pub fn ButtonPage() -> impl IntoView { - - - + + + - - - + + + diff --git a/demo/src/pages/home.rs b/demo/src/pages/home.rs index 5bc7575..02f98e7 100644 --- a/demo/src/pages/home.rs +++ b/demo/src/pages/home.rs @@ -24,7 +24,7 @@ pub fn Home() -> impl IntoView { }>"Read the docs" - - + + + @@ -59,9 +59,9 @@ pub fn MessagePage() -> impl IntoView { }; view! { - - - + + + } "#, diff --git a/demo/src/pages/modal/mod.rs b/demo/src/pages/modal/mod.rs index 3a3575a..c51287e 100644 --- a/demo/src/pages/modal/mod.rs +++ b/demo/src/pages/modal/mod.rs @@ -10,7 +10,7 @@ pub fn ModalPage() -> impl IntoView {

"Modal"

- + "hello" @@ -20,7 +20,7 @@ pub fn ModalPage() -> impl IntoView { r#" let show = create_rw_signal(false); - diff --git a/demo/src/pages/time_picker/mod.rs b/demo/src/pages/time_picker/mod.rs index dfe3b87..dee2dfa 100644 --- a/demo/src/pages/time_picker/mod.rs +++ b/demo/src/pages/time_picker/mod.rs @@ -11,7 +11,7 @@ pub fn TimePickerPage() -> impl IntoView {

"Time Picker"

- + {highlight_str!( @@ -41,7 +41,9 @@ pub fn TimePickerPage() -> impl IntoView { "value" - "RwSignal + + "RwSignal + diff --git a/demo/src/pages/toast/mod.rs b/demo/src/pages/toast/mod.rs index 29e368f..6757a70 100644 --- a/demo/src/pages/toast/mod.rs +++ b/demo/src/pages/toast/mod.rs @@ -93,7 +93,7 @@ pub fn ToastDemoPage() -> impl IntoView { }; view! {
- +
} } diff --git a/src/auto_complete/mod.rs b/src/auto_complete/mod.rs index bea9313..6964993 100644 --- a/src/auto_complete/mod.rs +++ b/src/auto_complete/mod.rs @@ -75,7 +75,7 @@ pub fn AutoComplete( return; } let key = event.key(); - if key == "ArrowDown".to_string() { + if key == *"ArrowDown" { select_option_index.update(|index| { if *index == options.with_untracked(|options| options.len()) - 1 { *index = 0 @@ -83,7 +83,7 @@ pub fn AutoComplete( *index += 1 } }); - } else if key == "ArrowUp".to_string() { + } else if key == *"ArrowUp" { select_option_index.update(|index| { if *index == 0 { *index = options.with_untracked(|options| options.len()) - 1; @@ -91,7 +91,7 @@ pub fn AutoComplete( *index -= 1 } }); - } else if key == "Enter".to_string() { + } else if key == *"Enter" { let option_value = options.with_untracked(|options| { let index = select_option_index.get_untracked(); if options.len() > index { @@ -175,6 +175,7 @@ pub fn AutoComplete( "thaw-auto-complete__menu-item--selected", move || index == select_option_index.get(), ) + on:click=on_click on:mousedown=on_mousedown on:mouseenter=on_mouseenter diff --git a/src/calendar/mod.rs b/src/calendar/mod.rs index b3a300d..9626f7c 100644 --- a/src/calendar/mod.rs +++ b/src/calendar/mod.rs @@ -121,8 +121,7 @@ pub fn Calendar(#[prop(optional, into)] value: RwSignal>) -> i show_date .with(|date| { format!( - "{} {}", - Month::try_from(date.month() as u8).unwrap().name(), + "{} {}", Month::try_from(date.month() as u8).unwrap().name(), date.year(), ) }) @@ -175,11 +174,11 @@ fn CalendarItem( let date = date.clone(); move |_| value.with(|value_date| value_date.as_ref() == Some(date.deref())) }); - let weekday_str = vec!["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; + let weekday_str = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; let on_click = { let date = date.clone(); move |_| { - value.set(Some(date.deref().clone())); + value.set(Some(*date.deref())); } }; view! { diff --git a/src/color_picker/mod.rs b/src/color_picker/mod.rs index a046147..4c99756 100644 --- a/src/color_picker/mod.rs +++ b/src/color_picker/mod.rs @@ -174,9 +174,8 @@ fn ColorPanel(hue: ReadSignal, sv: RwSignal<(f64, f64)>) -> impl IntoView { class="thaw-color-picker-popover__handle" style=move || { format!( - "left: calc({}% - 6px); bottom: calc({}% - 6px)", - sv.get().0 * 100.0, - sv.get().1 * 100.0, + "left: calc({}% - 6px); bottom: calc({}% - 6px)", sv.get().0 * 100.0, sv + .get().1 * 100.0, ) } > diff --git a/src/message/message_provider.rs b/src/message/message_provider.rs index d0465e0..3967abb 100644 --- a/src/message/message_provider.rs +++ b/src/message/message_provider.rs @@ -24,8 +24,7 @@ pub fn MessageProvider(children: Children) -> impl IntoView { - {children()} - + {children()}
diff --git a/src/time_picker/mod.rs b/src/time_picker/mod.rs index 68a655f..d72ac3e 100644 --- a/src/time_picker/mod.rs +++ b/src/time_picker/mod.rs @@ -80,7 +80,12 @@ pub fn TimePicker(#[prop(optional, into)] value: RwSignal>) ->
- + } @@ -116,12 +121,12 @@ fn Panel( }); css_vars }); - let now = move |_| { + let now = Callback::new(move |_| { close_panel.call(Some(now_time())); - }; - let ok = move |_| { + }); + let ok = Callback::new(move |_| { close_panel.call(selected_time.get_untracked()); - }; + }); let panel_ref = create_node_ref::(); #[cfg(any(feature = "csr", feature = "hydrate"))] @@ -170,7 +175,6 @@ fn Panel(
{(0..24) - .into_iter() .map(|hour| { let comp_ref = ComponentRef::::default(); let on_click = move |_| { @@ -191,12 +195,12 @@ fn Panel( } }) - .collect_view()}
+ .collect_view()} +
{(0..60) - .into_iter() .map(|minute| { let comp_ref = ComponentRef::::default(); let on_click = move |_| { @@ -217,12 +221,12 @@ fn Panel( } }) - .collect_view()}
+ .collect_view()} +
{(0..60) - .into_iter() .map(|second| { let comp_ref = ComponentRef::::default(); let on_click = move |_| { @@ -243,7 +247,8 @@ fn Panel( } }) - .collect_view()}
+ .collect_view()} +