portfolio_leptos/src/app/mod.rs

52 lines
1.8 KiB
Rust
Raw Normal View History

2023-10-08 21:36:00 +02:00
mod components;
2023-10-08 20:26:40 +02:00
use leptos::*;
use leptos_meta::*;
use leptos_router::*;
2023-10-08 22:02:08 +02:00
use leptos_icons::FaIcon::FaGithubBrands;
use leptos_icons::*;
2023-10-08 20:26:40 +02:00
#[component]
pub fn App() -> impl IntoView {
provide_meta_context();
view! {
<Stylesheet id="leptos" href="/pkg/portfolio.css"/>
<Link rel="shortcut icon" type_="image/ico" href="/favicon.ico"/>
<Router>
<Routes>
<Route path="" view= move || view! { <Home/> }/>
</Routes>
</Router>
}
}
#[component]
fn Home() -> impl IntoView {
let (count, set_count) = create_signal(0);
view! {
<main class="my-0 mx-auto max-w-3xl text-center">
<h2 class="p-6 text-4xl">"Welcome to Leptos with Tailwind"</h2>
<p class="px-10 pb-10 text-left">"Tailwind will scan your Rust files for Tailwind class names and compile them into a CSS file."</p>
2023-10-08 21:36:00 +02:00
<components::Tag>Salut</components::Tag>
<components::Link>Salut</components::Link>
2023-10-08 22:02:08 +02:00
<components::SocialLinkContainer>
<components::SocialLink icon=Icon::from(FaGithubBrands) url="https://github.com/mrdev023".to_string()>Github</components::SocialLink>
<components::SocialLink icon=Icon::from(FaGithubBrands) url="https://github.com/mrdev023".to_string()>Github</components::SocialLink>
</components::SocialLinkContainer>
2023-10-08 20:26:40 +02:00
<button
class="bg-amber-600 hover:bg-sky-700 px-5 py-3 text-white rounded-lg"
on:click=move |_| set_count.update(|count| *count += 1)
>
"Something's here | "
{move || if count() == 0 {
"Click me!".to_string()
} else {
count().to_string()
}}
" | Some more text"
</button>
</main>
}
}