Link aggregation and post comments on ATProto!
1// SPDX-FileCopyrightText: 2025 footnotes.social contributors
2//
3// SPDX-License-Identifier: MIT
4
5use leptos::prelude::*;
6use leptos_meta::{provide_meta_context, MetaTags, Stylesheet, Title};
7use leptos_router::{
8 components::{Route, Router, Routes},
9 StaticSegment,
10};
11
12pub fn shell(options: LeptosOptions) -> impl IntoView {
13 view! {
14 <!DOCTYPE html>
15 <html lang="en">
16 <head>
17 <meta charset="utf-8"/>
18 <meta name="viewport" content="width=device-width, initial-scale=1"/>
19 <AutoReload options=options.clone() />
20 <HydrationScripts options/>
21 <MetaTags/>
22 </head>
23 <body>
24 <App/>
25 </body>
26 </html>
27 }
28}
29
30#[component]
31pub fn App() -> impl IntoView {
32 // Provides context that manages stylesheets, titles, meta tags, etc.
33 provide_meta_context();
34
35 view! {
36 // injects a stylesheet into the document <head>
37 // id=leptos means cargo-leptos will hot-reload this stylesheet
38 <Stylesheet id="leptos" href="/pkg/footnotes_appview.css"/>
39
40 // sets the document title
41 <Title text="Welcome to Leptos"/>
42
43 // content for this welcome page
44 <Router>
45 <main>
46 <Routes fallback=|| "Page not found.".into_view()>
47 <Route path=StaticSegment("") view=HomePage/>
48 </Routes>
49 </main>
50 </Router>
51 }
52}
53
54/// Renders the home page of your application.
55#[component]
56fn HomePage() -> impl IntoView {
57 // Creates a reactive value to update the button
58 let count = RwSignal::new(0);
59 let on_click = move |_| *count.write() += 1;
60
61 view! {
62 <h1>"Welcome to Leptos!"</h1>
63 <button on:click=on_click>"Click Me: " {count}</button>
64 }
65}