1- use crate :: {
2- components:: {
3- blog:: Blog ,
4- links:: Links ,
5- name_header:: NameHeader ,
6- terminal:: { TerminalHistory , TerminalInput } ,
7- } ,
8- error_template:: { AppError , ErrorTemplate } ,
1+ use crate :: components:: blogpages:: esp32_relay:: Esp32Relay ;
2+ use crate :: components:: blogpages:: nix_frame_hack:: NixFrameHack ;
3+ use crate :: components:: {
4+ blog:: Blog ,
5+ links:: Links ,
6+ name_header:: NameHeader ,
7+ terminal:: { TerminalHistory , TerminalInput } ,
98} ;
10- use leptos:: * ;
9+ use leptos:: prelude :: * ;
1110use leptos_meta:: * ;
11+ use leptos_router:: components:: { Route , Router , Routes } ;
1212use leptos_router:: * ;
1313
14+ pub fn shell ( options : LeptosOptions ) -> impl IntoView {
15+ view ! {
16+ <!DOCTYPE html>
17+ <html lang="en" >
18+ <head>
19+ <meta charset="utf-8" />
20+ <meta name="viewport" content="width=device-width, initial-scale=1" />
21+ <AutoReload options=options. clone( ) />
22+ <HydrationScripts options />
23+ <MetaTags />
24+ </head>
25+ <body>
26+ <App />
27+ </body>
28+ </html>
29+ }
30+ }
31+
1432#[ component]
1533pub fn App ( ) -> impl IntoView {
1634 // Provides context that manages stylesheets, titles, meta tags, etc.
1735 provide_meta_context ( ) ;
1836
1937 view ! {
20- <Stylesheet id="leptos" href="/pkg/rabbitnook.css" />
21- <Link rel="preconnect" href="https://fonts.googleapis.com" />
22- <Link rel="preconnect" href="https://fonts.gstatic.com" />
38+ <Stylesheet id="leptos" href="/pkg/rabbitnook.css" />
39+ <Link rel="preconnect" href="https://fonts.googleapis.com" />
40+ <Link rel="preconnect" href="https://fonts.gstatic.com" />
2341 <Link
2442 href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap"
2543 rel="stylesheet"
@@ -28,26 +46,21 @@ pub fn App() -> impl IntoView {
2846 rel="stylesheet"
2947 href="//unpkg.com/@catppuccin/highlightjs@0.2.2/css/catppuccin-mocha.css"
3048 />
31- <Script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/rust.min.js" />
32- <Script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/json.min.js" />
33- <Script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/dockerfile.min.js" />
34- <Script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/es/languages/bash.min.js" />
35- <Script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" />
3649
3750 // sets the document title
38- <Title text="RabbitNook" />
51+ <Title text="RabbitNook" />
3952
40- // content for this welcome page
41- <Router fallback=|| {
42- let mut outside_errors = Errors :: default ( ) ;
43- outside_errors. insert_with_default_key( AppError :: NotFound ) ;
44- view! { <ErrorTemplate outside_errors/> } . into_view( )
45- } >
53+ <Router >
4654 <main>
47- <Routes >
48- <Route path="" view=HomePage />
49- <Route path="/blog" view=Blog />
50- <Route path="/blog/esp32-relay" view=Blog />
55+ <Routes fallback=|| "Not Found" >
56+ <Route path=path!( "" ) view=HomePage />
57+ <Route path=path!( "/blog" ) view=Blog ssr=SsrMode :: Async />
58+ <Route path=path!( "/blog/esp32-relay" ) view=Esp32Relay ssr=SsrMode :: Async />
59+ <Route
60+ path=path!( "/blog/nix-frame-hack" )
61+ view=NixFrameHack
62+ ssr=SsrMode :: Async
63+ />
5164 </Routes >
5265 </main>
5366 </Router >
@@ -57,21 +70,22 @@ pub fn App() -> impl IntoView {
5770/// Renders the home page of your application.
5871#[ component]
5972fn HomePage ( ) -> impl IntoView {
60- let ( command_history, set_command_history) = create_signal ( vec ! [ ] ) ;
61- let input_element: NodeRef < html:: Input > = create_node_ref ( ) ;
73+ let ( command_history, set_command_history) = signal ( vec ! [ ] ) ;
74+
75+ let input_element = NodeRef :: new ( ) ;
6276
6377 view ! {
6478 <div class="flex md:flex-row flex-col min-h-screen w-full bg-base items-center justify-center" >
6579 <div class="md:w-1/2 w-5/6 flex flex-col justify-center items-center" >
66- <NameHeader />
67- <Links />
80+ <NameHeader />
81+ <Links />
6882 <div class="w-44 mb-4" >
6983 <a href="https://ko-fi.com/safstromo" target="_blank" >
70- <img src="kofi_button_blue.png" />
84+ <img src="kofi_button_blue.png" />
7185 </a>
7286 </div>
7387
74- <nav class="my-4 text-white text-2xl font-semibold hover:border-peach border-base border-2 rounded-lg" >
88+ <nav class="my-2 text-white text-2xl font-semibold hover:border-peach border-base border-2 rounded-lg" >
7589 <a class="mx-1 text-white hover:text-maroon" href="/blog" >
7690 Blog
7791 </a>
@@ -84,9 +98,8 @@ fn HomePage() -> impl IntoView {
8498 let _ = input_element. get( ) . expect( "Input shoud be there to focus" ) . focus( ) ;
8599 }
86100 >
87-
88101 <p class="text-white m-2" >"Type 'help' for available commands." </p>
89- <TerminalHistory command_history=command_history/>
102+ <TerminalHistory command_history=command_history />
90103 <TerminalInput
91104 input_element=input_element
92105 set_command_history=set_command_history
0 commit comments