Setup for UI, without functions
This commit is contained in:
35
src/app.rs
Normal file
35
src/app.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use crate::navbar::Navbar;
|
||||
use crate::pages::{profile::Profile, settings::Settings};
|
||||
use yew::prelude::*;
|
||||
use yew_router::prelude::*;
|
||||
|
||||
#[derive(Clone, Routable, PartialEq)]
|
||||
pub enum Route {
|
||||
#[at("/")]
|
||||
Profile,
|
||||
#[at("/settings")]
|
||||
Settings,
|
||||
#[not_found]
|
||||
#[at("/404")]
|
||||
NotFound,
|
||||
}
|
||||
|
||||
fn switch(routes: Route) -> Html {
|
||||
match routes {
|
||||
Route::Settings => html! { <Settings/> },
|
||||
Route::Profile => html! { <Profile/> },
|
||||
Route::NotFound => html! { <h1 class="status-msg">{ "404 - Not Found" }</h1> },
|
||||
}
|
||||
}
|
||||
|
||||
#[function_component(App)]
|
||||
pub fn app() -> Html {
|
||||
html! {
|
||||
<BrowserRouter>
|
||||
<div class="feed-container">
|
||||
<Switch<Route> render={switch} />
|
||||
</div>
|
||||
<Navbar />
|
||||
</BrowserRouter>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user