Skip to content

Commit a02590f

Browse files
feat: formatting & add skeleton of progressnav
1 parent 9ee46d7 commit a02590f

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

src/app.rs

+29-19
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,21 @@ pub fn App() -> impl IntoView {
99
provide_meta_context();
1010

1111
view! {
12-
13-
// injects a stylesheet into the document <head>
14-
// id=leptos means cargo-leptos will hot-reload this stylesheet
15-
<Stylesheet id="leptos" href="/pkg/supermailer.css"/>
16-
<Link rel="shortcut icon" type_="image/ico" href="/favicon.ico"/>
12+
<Stylesheet id="leptos" href="/pkg/supermailer.css" />
13+
<Link rel="shortcut icon" type_="image/ico" href="/favicon.ico" />
1714

1815
// sets the document title
19-
<Title text="Welcome to Leptos"/>
16+
<Title text="Welcome to Leptos" />
2017

2118
// content for this welcome page
2219
<Router fallback=|| {
2320
let mut outside_errors = Errors::default();
2421
outside_errors.insert_with_default_key(AppError::NotFound);
25-
view! {
26-
<ErrorTemplate outside_errors/>
27-
}
28-
.into_view()
22+
view! { <ErrorTemplate outside_errors /> }.into_view()
2923
}>
3024
<main>
3125
<Routes>
32-
<Route path="" view=HomePage/>
26+
<Route path="/" view=HomePage />
3327
</Routes>
3428
</main>
3529
</Router>
@@ -44,8 +38,9 @@ fn HomePage() -> impl IntoView {
4438
let on_click = move |_| set_count.update(|count| *count += 1);
4539

4640
view! {
47-
<div class="bg-green-100">
48-
<div class="flex flex-col items-center justify-center min-h-screen">
41+
<div class="bg-gray-800">
42+
<ProgressNav />
43+
<div class="text-white flex flex-col justify-center items-center min-h-screen">
4944
<h1>"Welcome to Leptos!"</h1>
5045
<button on:click=on_click>"Click Me: " {count}</button>
5146
<Home />
@@ -60,21 +55,36 @@ fn Home() -> impl IntoView {
6055

6156
// thanks to https://tailwindcomponents.com/component/blue-buttons-example for the showcase layout
6257
view! {
63-
<Title text="Leptos + Tailwindcss"/>
58+
<Title text="Leptos + Tailwindcss" />
6459
<main>
65-
<div class="bg-gradient-to-tl from-blue-800 to-blue-500 text-white font-mono">
60+
<div class="font-mono text-white bg-gradient-to-tl from-blue-800 to-blue-500">
6661
<div class="flex">
67-
<button on:click=move |_| set_value.update(|value| *value += 1) class="rounded px-3 py-2 m-1 border-b-4 border-l-2 shadow-lg bg-blue-700 border-blue-800 text-white">
62+
<button
63+
on:click=move |_| set_value.update(|value| *value += 1)
64+
class="py-2 px-3 m-1 text-white bg-blue-700 rounded border-l-2 border-b-4 border-blue-800 shadow-lg"
65+
>
6866
"+"
6967
</button>
70-
<button class="rounded px-3 py-2 m-1 border-b-4 border-l-2 shadow-lg bg-blue-800 border-blue-900 text-white">
68+
<button class="py-2 px-3 m-1 text-white bg-blue-800 rounded border-l-2 border-b-4 border-blue-900 shadow-lg">
7169
{value}
7270
</button>
73-
<button on:click=move |_| set_value.update(|value| *value -= 1) class="rounded px-3 py-2 m-1 border-b-4 border-l-2 shadow-lg bg-blue-700 border-blue-800 text-white">
71+
<button
72+
on:click=move |_| set_value.update(|value| *value -= 1)
73+
class="py-2 px-3 m-1 text-white bg-blue-700 rounded border-l-2 border-b-4 border-blue-800 shadow-lg"
74+
>
7475
"-"
7576
</button>
7677
</div>
7778
</div>
7879
</main>
7980
}
80-
}
81+
}
82+
83+
#[component]
84+
fn ProgressNav() -> impl IntoView {
85+
view! {
86+
<div class="fixed top-0 right-0 left-0 h-0.5 bg-white">
87+
<div class="bg-gray-900 h-0.5 w-1/3" />
88+
</div>
89+
}
90+
}

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use cfg_if::cfg_if;
2+
#[cfg(feature = "ssr")]
3+
pub mod api;
24
pub mod app;
35
pub mod error_template;
46
pub mod fileserv;
57
#[cfg(feature = "ssr")]
68
pub mod state;
7-
#[cfg(feature = "ssr")]
8-
pub mod api;
99

1010
cfg_if! { if #[cfg(feature = "hydrate")] {
1111
use leptos::*;

0 commit comments

Comments
 (0)