Init with webapp template

This commit is contained in:
Quentin Boyer 2023-05-19 11:23:44 +02:00
commit 37331cd24d
13 changed files with 2709 additions and 0 deletions

40
app/src/main.rs Normal file
View file

@ -0,0 +1,40 @@
use log::Level;
use yew::prelude::*;
use yew_router::prelude::*;
#[derive(Routable, Debug, Clone, Copy, PartialEq, Eq)]
enum Route {
#[at("/")]
Index,
#[at("/404")]
#[not_found]
NotFound,
}
#[function_component]
fn App() -> Html {
html! {
<BrowserRouter>
<main>
<Switch<Route> render={switch} />
</main>
</BrowserRouter>
}
}
fn switch(route: Route) -> Html {
match route {
Route::Index => html! {
"Index"
},
Route::NotFound => html! {
"Page not found"
},
}
}
fn main() {
console_log::init_with_level(Level::Debug).unwrap();
yew::Renderer::<App>::new().render();
}