feat(webserver): Vendor and reimplement main pages in leptos
This commit is contained in:
parent
aeba7301b0
commit
59fdb37222
25 changed files with 4862 additions and 176 deletions
56
pkgs/packages/webserver/src/app.rs
Normal file
56
pkgs/packages/webserver/src/app.rs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
use leptos::prelude::*;
|
||||
use leptos_meta::{provide_meta_context, MetaTags, Stylesheet};
|
||||
use leptos_router::{
|
||||
components::{Route, Router, Routes},
|
||||
StaticSegment,
|
||||
};
|
||||
|
||||
mod homepage;
|
||||
mod mail;
|
||||
|
||||
use crate::components::Navbar;
|
||||
use homepage::HomePage;
|
||||
use mail::Mail;
|
||||
|
||||
pub fn shell(options: LeptosOptions) -> impl IntoView {
|
||||
view! {
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
||||
<link rel="icon" type="image/png" href="/favicon-48.png" sizes="48x48" />
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<meta name="author" content="Tristan Daniël Maat" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<AutoReload options=options.clone() />
|
||||
<HydrationScripts options />
|
||||
<MetaTags />
|
||||
</head>
|
||||
<body>
|
||||
<App />
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn App() -> impl IntoView {
|
||||
provide_meta_context();
|
||||
|
||||
view! {
|
||||
<Stylesheet href="/pkg/tlaternet-webserver.css" />
|
||||
|
||||
<Navbar />
|
||||
|
||||
// content for this welcome page
|
||||
<Router>
|
||||
<main>
|
||||
<Routes fallback=|| "Page not found.".into_view()>
|
||||
<Route path=StaticSegment("") view=HomePage />
|
||||
<Route path=StaticSegment("mail") view=Mail />
|
||||
</Routes>
|
||||
</main>
|
||||
</Router>
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue