From 31bfd4d1265e78971e50738b42bcf05d6be86dd7 Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Wed, 28 Aug 2024 18:55:29 -0700 Subject: [PATCH] formatting --- .rustfmt.toml | 1 + leptosfmt.toml | 2 ++ rust-analyzer.toml | 2 ++ src/main.rs | 22 +++++++++++++------- src/views.rs | 52 +++++++++++++++++++++++++++++++++++++--------- 5 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 .rustfmt.toml create mode 100644 leptosfmt.toml create mode 100644 rust-analyzer.toml diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..3a26366 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1 @@ +edition = "2021" diff --git a/leptosfmt.toml b/leptosfmt.toml new file mode 100644 index 0000000..809d5d6 --- /dev/null +++ b/leptosfmt.toml @@ -0,0 +1,2 @@ +[attr_values] +class = "Tailwind" # "Tailwind" is the only attribute value formatter available for now diff --git a/rust-analyzer.toml b/rust-analyzer.toml new file mode 100644 index 0000000..9eab123 --- /dev/null +++ b/rust-analyzer.toml @@ -0,0 +1,2 @@ +[rustfmt] +overrideCommand = ["leptosfmt", "--stdin", "--rustfmt"] diff --git a/src/main.rs b/src/main.rs index 513a555..dff9719 100644 --- a/src/main.rs +++ b/src/main.rs @@ -137,9 +137,7 @@ async fn remaining( async fn welcome() -> impl IntoResponse { let cat_fact = views::get_cat_fact().await; Html(ssr::render(move || { - leptos::view! { - - } + leptos::view! { } })) } @@ -157,15 +155,23 @@ async fn records_links(State(state): State) -> impl IntoResponse {
    - {records.keys().map(|key| leptos::view! { + {records + .keys() + .map(|key| { + leptos::view! { - }) + } + }) .collect::>()}
@@ -190,7 +196,7 @@ async fn link( return Ok(Html(ssr::render({ let record = record.clone(); || { - leptos::view! { } + leptos::view! { } } }))); } diff --git a/src/views.rs b/src/views.rs index d0a2b48..ca9dd41 100644 --- a/src/views.rs +++ b/src/views.rs @@ -33,11 +33,26 @@ pub fn Welcome(fact: String) -> impl IntoView { #[component] pub fn WelcomeView(fact: String) -> impl IntoView { view! { -
+
- +
- + @@ -72,7 +87,11 @@ pub fn HtmxPage(children: Children) -> impl IntoView { + @@ -89,16 +108,29 @@ pub fn LinkView(id: String, record: UploadRecord) -> impl IntoView { view! {
- } }