2023-09-28 11:08:15 +00:00
|
|
|
mod topbar;
|
|
|
|
|
|
|
|
use yew::prelude::*;
|
2023-09-28 12:23:12 +00:00
|
|
|
use yew_router::prelude::*;
|
2023-09-28 11:08:15 +00:00
|
|
|
use topbar::TopBar;
|
|
|
|
|
2023-09-28 12:23:12 +00:00
|
|
|
#[derive(Clone, Routable, PartialEq)]
|
|
|
|
enum Route {
|
|
|
|
#[at("/")]
|
|
|
|
Home,
|
|
|
|
#[at("/services")]
|
|
|
|
Services,
|
|
|
|
#[at("/community")]
|
|
|
|
Community,
|
|
|
|
#[at("/about")]
|
|
|
|
About,
|
|
|
|
#[not_found]
|
|
|
|
#[at("/404")]
|
|
|
|
NotFound,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn switch(routes: Route) -> Html {
|
|
|
|
match routes {
|
|
|
|
Route::Home => html! { <h1>{ "Home" }</h1> },
|
|
|
|
Route::Services => html! {<h1>{ "Services" }</h1>},
|
|
|
|
Route::Community => html! {<h1>{ "Community" }</h1>},
|
|
|
|
Route::About => html! {<h1>{ "About" }</h1>},
|
|
|
|
Route::NotFound => html! { <h1>{ "404" }</h1> },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-28 11:08:15 +00:00
|
|
|
#[function_component]
|
2023-09-28 11:58:08 +00:00
|
|
|
fn App() -> Html {
|
2023-09-28 11:08:15 +00:00
|
|
|
html! {
|
2023-09-28 12:23:12 +00:00
|
|
|
<div>
|
|
|
|
<TopBar/>
|
|
|
|
<main>
|
|
|
|
<BrowserRouter>
|
|
|
|
<Switch<Route> render={switch} />
|
|
|
|
</BrowserRouter>
|
|
|
|
</main>
|
|
|
|
</div>
|
2023-09-28 11:08:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2023-09-28 11:58:08 +00:00
|
|
|
yew::Renderer::<App>::new().render();
|
2023-09-28 11:08:15 +00:00
|
|
|
}
|