nationtech-website/sreez/src/app.rs

59 lines
1.9 KiB
Rust

use leptos::*;
use leptos_meta::*;
use leptos_router::*;
use crate::pages::ShortLandingPage;
use crate::pages::HomePage;
use crate::pages::InitialOffer;
#[component]
pub fn App() -> impl IntoView {
// Provides context that manages stylesheets, titles, meta tags, etc.
provide_meta_context();
view! {
// injects a stylesheet into the document <head>
// id=leptos means cargo-leptos will hot-reload this stylesheet
<Stylesheet id="leptos" href="/pkg/sreez.css"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
// sets the document title
<Title text="SREEZ - Site Reliability Engineering for Everyone, eZ"/>
// content for this welcome page
<Router>
<main class="bg-main bg-light">
<Routes>
<Route path="" view=ShortLandingPage/>
<Route path="/home-page" view=HomePage/>
<Route path="/initial-offer" view=InitialOffer/>
<Route path="/*any" view=NotFound/>
</Routes>
</main>
</Router>
}
}
/// 404 - Not Found
#[component]
fn NotFound() -> impl IntoView {
// set an HTTP status code 404
// this is feature gated because it can only be done during
// initial server-side rendering
// if you navigate to the 404 page subsequently, the status
// code will not be set because there is not a new HTTP request
// to the server
#[cfg(feature = "ssr")]
{
// this can be done inline because it's synchronous
// if it were async, we'd use a server function
let resp = expect_context::<leptos_actix::ResponseOptions>();
resp.set_status(actix_web::http::StatusCode::NOT_FOUND);
}
view! {
<h1>"Not Found"</h1>
}
}