From 18224d34108bc68c5a83295e919fe8f8732c792f Mon Sep 17 00:00:00 2001 From: jeangab Date: Wed, 12 Apr 2023 06:42:58 -0400 Subject: [PATCH] Refactor imports, cleaner now --- src/app.rs | 16 ++-------------- src/routes/home/mod.rs | 2 ++ src/routes/home/page.rs | 14 ++++++++++++++ src/routes/mod.rs | 1 + src/routes/whymdc/mod.rs | 6 ++++-- 5 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 src/routes/home/mod.rs create mode 100644 src/routes/home/page.rs diff --git a/src/app.rs b/src/app.rs index 19c2aa4..5b877d7 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,5 +1,5 @@ -use crate::routes::whymdc::page::WhyMicroDatacentersProps; -use crate::routes::whymdc::page::WhyMicroDatacenters; +use crate::routes::whymdc::*; +use crate::routes::home::*; use leptos::*; use leptos_meta::*; use leptos_router::*; @@ -31,15 +31,3 @@ pub fn App(cx: Scope) -> impl IntoView { } } -/// Renders the home page of your application. -#[component] -fn HomePage(cx: Scope) -> impl IntoView { - // Creates a reactive value to update the button - let (count, set_count) = create_signal(cx, 0); - let on_click = move |_| set_count.update(|count| *count += 1); - - view! { cx, -

"Welcome to Nationtech.io!"

- - } -} diff --git a/src/routes/home/mod.rs b/src/routes/home/mod.rs new file mode 100644 index 0000000..f5f67f8 --- /dev/null +++ b/src/routes/home/mod.rs @@ -0,0 +1,2 @@ +mod page; +pub use page::*; diff --git a/src/routes/home/page.rs b/src/routes/home/page.rs new file mode 100644 index 0000000..c7829f9 --- /dev/null +++ b/src/routes/home/page.rs @@ -0,0 +1,14 @@ +use leptos::*; + +/// Renders the home page of your application. +#[component] +pub fn HomePage(cx: Scope) -> impl IntoView { + // Creates a reactive value to update the button + let (count, set_count) = create_signal(cx, 0); + let on_click = move |_| set_count.update(|count| *count += 1); + + view! { cx, +

"Welcome to Nationtech.io! Through proper import paths"

+ + } +} diff --git a/src/routes/mod.rs b/src/routes/mod.rs index a3bae63..3a61048 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -1 +1,2 @@ pub mod whymdc; +pub mod home; diff --git a/src/routes/whymdc/mod.rs b/src/routes/whymdc/mod.rs index 882a2a8..cfa652b 100644 --- a/src/routes/whymdc/mod.rs +++ b/src/routes/whymdc/mod.rs @@ -1,2 +1,4 @@ -pub mod page; -pub mod components; +mod page; +pub use page::*; + +mod components;