Refactor imports, cleaner now

This commit is contained in:
jeangab 2023-04-12 06:42:58 -04:00
parent ad51c3b664
commit 18224d3410
5 changed files with 23 additions and 16 deletions

View File

@ -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,
<h1 class="text-9xl">"Welcome to Nationtech.io!"</h1>
<button on:click=on_click>"Click Me: " {count}</button>
}
}

2
src/routes/home/mod.rs Normal file
View File

@ -0,0 +1,2 @@
mod page;
pub use page::*;

14
src/routes/home/page.rs Normal file
View File

@ -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,
<h1 class="text-9xl">"Welcome to Nationtech.io! Through proper import paths"</h1>
<button on:click=on_click>"Click Me: " {count}</button>
}
}

View File

@ -1 +1,2 @@
pub mod whymdc;
pub mod home;

View File

@ -1,2 +1,4 @@
pub mod page;
pub mod components;
mod page;
pub use page::*;
mod components;