From 61284d57fc890442ddb5a8f1b01a6391982d7680 Mon Sep 17 00:00:00 2001 From: luoxiao Date: Tue, 13 Aug 2024 14:47:13 +0800 Subject: [PATCH] cargo fmt & leptosfmt --- thaw/src/accordion/accordion_item.rs | 20 +-- thaw/src/accordion/mod.rs | 6 +- thaw/src/anchor/anchor_link.rs | 11 +- thaw/src/anchor/mod.rs | 5 +- thaw/src/auto_complete/mod.rs | 37 ++++-- thaw/src/avatar/mod.rs | 85 +++++++------ thaw/src/back_top/mod.rs | 27 ++-- thaw/src/badge/badge.rs | 12 +- thaw/src/breadcrumb/mod.rs | 36 ++++-- thaw/src/button/button_group.rs | 3 +- thaw/src/button/mod.rs | 25 ++-- thaw/src/calendar/mod.rs | 23 ++-- thaw/src/card/card_footer.rs | 6 +- thaw/src/card/card_header.rs | 12 +- thaw/src/card/mod.rs | 5 +- thaw/src/checkbox/mod.rs | 56 ++++++--- thaw/src/code/mod.rs | 5 +- thaw/src/color_picker/mod.rs | 10 +- thaw/src/combobox/combobox.rs | 74 +++++++---- thaw/src/combobox/combobox_option.rs | 66 ++++++---- thaw/src/combobox/combobox_option_group.rs | 3 +- thaw/src/date_picker/mod.rs | 5 +- thaw/src/date_picker/panel/date_panel.rs | 2 +- thaw/src/date_picker/panel/mod.rs | 16 ++- thaw/src/date_picker/panel/month_panel.rs | 2 +- thaw/src/date_picker/panel/year_panel.rs | 2 +- thaw/src/dialog/dialog.rs | 4 +- thaw/src/dialog/dialog_actions.rs | 6 +- thaw/src/dialog/dialog_body.rs | 6 +- thaw/src/dialog/dialog_content.rs | 6 +- thaw/src/dialog/dialog_title.rs | 6 +- thaw/src/divider/mod.rs | 13 +- thaw/src/drawer/drawer_body.rs | 4 +- thaw/src/drawer/drawer_header.rs | 6 +- thaw/src/drawer/drawer_header_title.rs | 8 +- thaw/src/drawer/inline_drawer.rs | 17 +-- thaw/src/drawer/overlay_drawer.rs | 19 ++- thaw/src/grid/grid_item.rs | 5 +- thaw/src/grid/mod.rs | 5 +- thaw/src/image/mod.rs | 6 +- thaw/src/layout/layout_header.rs | 6 +- thaw/src/layout/layout_sider.rs | 6 +- thaw/src/layout/mod.rs | 12 +- thaw/src/loading_bar/loading_bar_provider.rs | 2 +- thaw/src/menu/menu_item.rs | 2 +- thaw/src/message_bar/message_bar.rs | 99 +++++++++++---- thaw/src/message_bar/message_bar_actions.rs | 4 +- thaw/src/message_bar/message_bar_body.rs | 6 +- thaw/src/message_bar/message_bar_title.rs | 6 +- thaw/src/nav/nav_category.rs | 31 ++--- thaw/src/nav/nav_drawer.rs | 9 +- thaw/src/nav/nav_item.rs | 32 ++--- thaw/src/pagination/mod.rs | 62 ++++----- thaw/src/popover/mod.rs | 3 +- thaw/src/progress_bar/progress_bar.rs | 3 +- thaw/src/progress_bar/progress_circle.rs | 3 +- thaw/src/radio/mod.rs | 13 +- thaw/src/radio/radio_group.rs | 11 +- thaw/src/scrollbar/mod.rs | 26 ++-- thaw/src/skeleton/skeleton.rs | 6 +- thaw/src/skeleton/skeleton_item.rs | 5 +- thaw/src/slider/mod.rs | 11 +- thaw/src/slider/slider_label.rs | 6 +- thaw/src/space/mod.rs | 12 +- thaw/src/spin_button/mod.rs | 44 +++++-- thaw/src/spinner/mod.rs | 27 ++-- thaw/src/switch/mod.rs | 27 ++-- thaw/src/tab_list/mod.rs | 5 +- thaw/src/tab_list/tab.rs | 11 +- thaw/src/table/mod.rs | 58 +++------ thaw/src/tag/mod.rs | 29 +++-- thaw/src/text/mod.rs | 12 +- thaw/src/textarea/mod.rs | 14 +-- thaw/src/time_picker/mod.rs | 2 +- thaw/src/toast/toast.rs | 6 +- thaw/src/toast/toast_body.rs | 8 +- thaw/src/toast/toast_footer.rs | 6 +- thaw/src/toast/toast_title.rs | 37 +++--- thaw/src/toast/toaster.rs | 126 +++++++++---------- thaw/src/toast/toaster_provider.rs | 9 +- thaw/src/upload/mod.rs | 7 +- thaw/src/upload/upload_dragger.rs | 6 +- 82 files changed, 790 insertions(+), 685 deletions(-) diff --git a/thaw/src/accordion/accordion_item.rs b/thaw/src/accordion/accordion_item.rs index 2e48534..afc5a3a 100644 --- a/thaw/src/accordion/accordion_item.rs +++ b/thaw/src/accordion/accordion_item.rs @@ -50,23 +50,25 @@ pub fn AccordionItem( type="button" on:click=on_click > - } } diff --git a/thaw/src/radio/radio_group.rs b/thaw/src/radio/radio_group.rs index eb2e2ed..41a7ed5 100644 --- a/thaw/src/radio/radio_group.rs +++ b/thaw/src/radio/radio_group.rs @@ -5,7 +5,8 @@ use thaw_utils::{class_list, OptionModel}; pub fn RadioGroup( #[prop(optional, into)] class: MaybeProp, /// The selected Radio item in this group. - #[prop(optional, into)] value: OptionModel, + #[prop(optional, into)] + value: OptionModel, /// The name of this radio group. #[prop(optional, into)] name: Option, @@ -14,8 +15,12 @@ pub fn RadioGroup( let name = name.unwrap_or_else(|| uuid::Uuid::new_v4().to_string()); view! { - -
+ +
{children()}
diff --git a/thaw/src/scrollbar/mod.rs b/thaw/src/scrollbar/mod.rs index 5852329..6d4b37b 100644 --- a/thaw/src/scrollbar/mod.rs +++ b/thaw/src/scrollbar/mod.rs @@ -6,11 +6,14 @@ pub fn Scrollbar( #[prop(optional, into)] class: MaybeProp, #[prop(optional, into)] style: MaybeProp, /// Class name of content div. - #[prop(optional, into)] content_class: MaybeProp, + #[prop(optional, into)] + content_class: MaybeProp, /// Style of content div. - #[prop(optional, into)] content_style: MaybeProp, + #[prop(optional, into)] + content_style: MaybeProp, /// Size of scrollbar. - #[prop(default = 8)] size: u8, + #[prop(default = 8)] + size: u8, #[prop(optional)] comp_ref: Option>, children: Children, ) -> impl IntoView { @@ -299,15 +302,10 @@ pub fn Scrollbar(
impl IntoView { view! { -
+
{children()}
} diff --git a/thaw/src/skeleton/skeleton_item.rs b/thaw/src/skeleton/skeleton_item.rs index 5337941..ce56d2a 100644 --- a/thaw/src/skeleton/skeleton_item.rs +++ b/thaw/src/skeleton/skeleton_item.rs @@ -5,8 +5,5 @@ use thaw_utils::{class_list, mount_style}; pub fn SkeletonItem(#[prop(optional, into)] class: MaybeProp) -> impl IntoView { mount_style("skeleton-item", include_str!("./skeleton-item.css")); - view! { -
-
- } + view! {
} } diff --git a/thaw/src/slider/mod.rs b/thaw/src/slider/mod.rs index 7b6825d..f7ebf8f 100644 --- a/thaw/src/slider/mod.rs +++ b/thaw/src/slider/mod.rs @@ -76,10 +76,7 @@ pub fn Slider( view! { -
+
-
-
-
-
+
+
{children()} diff --git a/thaw/src/slider/slider_label.rs b/thaw/src/slider/slider_label.rs index 256db5a..248b149 100644 --- a/thaw/src/slider/slider_label.rs +++ b/thaw/src/slider/slider_label.rs @@ -20,11 +20,7 @@ pub fn SliderLabel( }; view! { - diff --git a/thaw/src/space/mod.rs b/thaw/src/space/mod.rs index 71242f3..eb2dd9a 100644 --- a/thaw/src/space/mod.rs +++ b/thaw/src/space/mod.rs @@ -16,13 +16,17 @@ pub enum SpaceGap { pub fn Space( #[prop(optional, into)] class: MaybeProp, /// Space's gap. - #[prop(optional)] gap: SpaceGap, + #[prop(optional)] + gap: SpaceGap, /// Whether to lay out vertically. - #[prop(optional)] vertical: bool, + #[prop(optional)] + vertical: bool, /// Vertical arrangement. - #[prop(optional, into)] align: MaybeProp, + #[prop(optional, into)] + align: MaybeProp, /// Horizontal arrangement. - #[prop(optional, into)] justify: MaybeProp, + #[prop(optional, into)] + justify: MaybeProp, children: ChildrenFragment, ) -> impl IntoView { mount_style("space", include_str!("./space.css")); diff --git a/thaw/src/spin_button/mod.rs b/thaw/src/spin_button/mod.rs index 44446fc..24099b5 100644 --- a/thaw/src/spin_button/mod.rs +++ b/thaw/src/spin_button/mod.rs @@ -78,9 +78,11 @@ where }; view! { - + - diff --git a/thaw/src/spinner/mod.rs b/thaw/src/spinner/mod.rs index c7a8171..ea1e23c 100644 --- a/thaw/src/spinner/mod.rs +++ b/thaw/src/spinner/mod.rs @@ -55,26 +55,29 @@ pub fn Spinner( view! {
- { - move || { - if let Some(label) = label.get() { - view! { - - }.into() - } else { - None + {move || { + if let Some(label) = label.get() { + view! { + } + .into() + } else { + None } - } + }}
} } diff --git a/thaw/src/switch/mod.rs b/thaw/src/switch/mod.rs index dc52834..3ecc704 100644 --- a/thaw/src/switch/mod.rs +++ b/thaw/src/switch/mod.rs @@ -5,9 +5,11 @@ use thaw_utils::{class_list, mount_style, Model}; pub fn Switch( #[prop(optional, into)] class: MaybeProp, /// Defines the controlled checked state of the Switch. - #[prop(optional, into)] checked: Model, + #[prop(optional, into)] + checked: Model, /// The Switch's label. - #[prop(optional, into)] label: MaybeProp, + #[prop(optional, into)] + label: MaybeProp, ) -> impl IntoView { mount_style("switch", include_str!("./switch.css")); @@ -30,19 +32,28 @@ pub fn Switch( on:change=on_change /> - { - move || if let Some(label) = label.get() { + {move || { + if let Some(label) = label.get() { view! { - - }.into() + + } + .into() } else { None } - } + }}
} } diff --git a/thaw/src/tab_list/mod.rs b/thaw/src/tab_list/mod.rs index 3ed89de..b0a4893 100644 --- a/thaw/src/tab_list/mod.rs +++ b/thaw/src/tab_list/mod.rs @@ -24,10 +24,7 @@ pub fn TabList( selected_value, registered_tabs, }> -
+
{children()}
diff --git a/thaw/src/tab_list/tab.rs b/thaw/src/tab_list/tab.rs index 3eba81e..767b47b 100644 --- a/thaw/src/tab_list/tab.rs +++ b/thaw/src/tab_list/tab.rs @@ -7,7 +7,8 @@ use thaw_utils::{class_list, mount_style}; pub fn Tab( #[prop(optional, into)] class: MaybeProp, /// The indentifier of the tab. - #[prop(into)] value: String, + #[prop(into)] + value: String, children: Children, ) -> impl IntoView { mount_style("tab", include_str!("./tab.css")); @@ -62,17 +63,13 @@ pub fn Tab( view! { } } diff --git a/thaw/src/table/mod.rs b/thaw/src/table/mod.rs index 92a34ba..e965f84 100644 --- a/thaw/src/table/mod.rs +++ b/thaw/src/table/mod.rs @@ -8,11 +8,7 @@ pub fn Table( ) -> impl IntoView { mount_style("table", include_str!("./table.css")); - view! { - - {children()} -
- } + view! { {children()}
} } #[component] @@ -20,11 +16,7 @@ pub fn TableHeader( #[prop(optional, into)] class: MaybeProp, children: Children, ) -> impl IntoView { - view! { - - {children()} - - } + view! { {children()} } } #[component] @@ -35,13 +27,11 @@ pub fn TableHeaderCell( view! { } @@ -52,11 +42,7 @@ pub fn TableBody( #[prop(optional, into)] class: MaybeProp, children: Children, ) -> impl IntoView { - view! { - - {children()} - - } + view! { {children()} } } #[component] @@ -64,11 +50,7 @@ pub fn TableRow( #[prop(optional, into)] class: MaybeProp, children: Children, ) -> impl IntoView { - view! { - - {children()} - - } + view! { {children()} } } #[component] @@ -77,14 +59,14 @@ pub fn TableCell( #[prop(optional)] children: Option, ) -> impl IntoView { view! { - - { - if let Some(children) = children { - Either::Left(children()) - } else { - Either::Right(()) - } - } + + {if let Some(children) = children { + Either::Left(children()) + } else { + Either::Right(()) + }} } } @@ -94,9 +76,5 @@ pub fn TableCellLayout( #[prop(optional, into)] class: MaybeProp, children: Children, ) -> impl IntoView { - view! { -
- {children()} -
- } + view! {
{children()}
} } diff --git a/thaw/src/tag/mod.rs b/thaw/src/tag/mod.rs index 41be517..f0edb14 100644 --- a/thaw/src/tag/mod.rs +++ b/thaw/src/tag/mod.rs @@ -15,10 +15,8 @@ pub fn Tag( mount_style("tag", include_str!("./tag.css")); view! { - - > {children()} {move || { @@ -30,13 +28,24 @@ pub fn Tag( on_close(event); }; if closable.get() { - Either::Left(view! { - - }) + Either::Left( + view! { + + }, + ) } else { Either::Right(()) } diff --git a/thaw/src/text/mod.rs b/thaw/src/text/mod.rs index 2cbd262..b4722a8 100644 --- a/thaw/src/text/mod.rs +++ b/thaw/src/text/mod.rs @@ -11,9 +11,7 @@ pub fn Caption1( let class = Signal::derive(move || format!("thaw-caption-1 {}", class.get().unwrap_or_default())); - view! { - - } + view! { } } #[component] @@ -27,9 +25,7 @@ pub fn Caption1Strong( format!("thaw-caption-1-strong {}", class.get().unwrap_or_default()) }); - view! { - - } + view! { } } #[component] @@ -41,9 +37,7 @@ pub fn Body1( ) -> impl IntoView { let class = Signal::derive(move || format!("thaw-body-1 {}", class.get().unwrap_or_default())); - view! { - - } + view! { } } #[component] diff --git a/thaw/src/textarea/mod.rs b/thaw/src/textarea/mod.rs index 1577c97..e992fb3 100644 --- a/thaw/src/textarea/mod.rs +++ b/thaw/src/textarea/mod.rs @@ -72,14 +72,12 @@ pub fn Textarea( // } view! { - +