Skip to content

Commit

Permalink
feat: show a random slogan when you load the page
Browse files Browse the repository at this point in the history
  • Loading branch information
Phosphorus-M committed Aug 29, 2023
1 parent f3e30fa commit 4a3600e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ gloo-net = { version = "0.2", features = ["http"] }
wasm-bindgen = { version = "0.2" }
console_log = { version = "1"}
console_error_panic_hook = { version = "0.1"}
rand = "0.8.5"

[profile.release]
opt-level = "z" # Optimize for size.
Expand Down
15 changes: 14 additions & 1 deletion src/components/hero.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
use leptos::*;

use crate::components::header::Header;
use rand::seq::SliceRandom;

#[component]
pub fn Hero() -> impl IntoView {
let slogans = [
"Una comunidad de gente mal intencionada y tonta.",
"9 de cada 10 Go dev's lo recomiendan",
"Acá le pegamos a la rústica bien recio",
"⚡ Blazingly fast ⚡ 🚀🚀🚀 Super fast 🔥🔥🔥🔥 pero ahora en español!!",
"Si te falla va ser de forma segura 😉",
"Furrificando..."
];

let sloganToShow = slogans.choose(&mut rand::thread_rng()).unwrap();


view! {
<section class="w-full flex flex-col">
<Header/>
Expand All @@ -25,7 +38,7 @@ pub fn Hero() -> impl IntoView {
</span>
</h1>
<p class="font-work-sans font-light text-center lg:text-left">
"Una comunidad de gente mal intencionada y tonta."
{sloganToShow.to_string()}
</p>
</div>
</div>
Expand Down

0 comments on commit 4a3600e

Please sign in to comment.