Skip to content

Commit 986cb8e

Browse files
committed
feat: show a random slogan when you load the page
1 parent f3e30fa commit 986cb8e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ gloo-net = { version = "0.2", features = ["http"] }
1414
wasm-bindgen = { version = "0.2" }
1515
console_log = { version = "1"}
1616
console_error_panic_hook = { version = "0.1"}
17+
rand = "0.8.5"
1718

1819
[profile.release]
1920
opt-level = "z" # Optimize for size.

src/components/hero.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
use leptos::*;
22

33
use crate::components::header::Header;
4+
use rand::seq::SliceRandom;
45

56
#[component]
67
pub fn Hero() -> impl IntoView {
8+
let slogans = vec![
9+
"Una comunidad de gente mal intencionada y tonta.",
10+
"9 de cada 10 Go dev's lo recomiendan",
11+
"Acá le pegamos a la rústica bien recio",
12+
"⚡ Blazingly fast ⚡ 🚀🚀🚀 Super fast 🔥🔥🔥🔥 pero ahora en español!!",
13+
"Si te falla va ser de forma segura 😉",
14+
"Furrificando..."
15+
];
16+
17+
let sloganToShow = slogans.choose(&mut rand::thread_rng()).unwrap();
18+
19+
720
view! {
821
<section class="w-full flex flex-col">
922
<Header/>
@@ -25,7 +38,7 @@ pub fn Hero() -> impl IntoView {
2538
</span>
2639
</h1>
2740
<p class="font-work-sans font-light text-center lg:text-left">
28-
"Una comunidad de gente mal intencionada y tonta."
41+
{sloganToShow.to_string()}
2942
</p>
3043
</div>
3144
</div>

0 commit comments

Comments
 (0)