Skip to content

Commit 76ab10e

Browse files
committed
Se agregan y modifican componentes para el hacktoberfest
1 parent 994e8d7 commit 76ab10e

File tree

4 files changed

+113
-1
lines changed

4 files changed

+113
-1
lines changed

src/components/button_large_link.rs

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
use leptos::{component, view, Children, IntoView};
2+
use std::collections::HashMap;
3+
4+
#[component]
5+
pub fn ButtonLargeLink(
6+
#[prop(into)] href: String,
7+
#[prop(default = "primary")] color: &'static str,
8+
#[prop(default = "normal")] size: &'static str,
9+
#[prop(default = "drop")] shadow: &'static str,
10+
#[prop(into, optional)] class: String,
11+
children: Children,
12+
) -> impl IntoView {
13+
let colors = HashMap::from([
14+
(
15+
"primary",
16+
"bg-orange-200 dark:bg-transparent hover:bg-black hover:text-white",
17+
),
18+
("white", "bg-orange-100 dark:bg-transparent hover:bg-black hover:text-white"),
19+
]);
20+
let shadows = HashMap::from([
21+
("drop", "drop-shadow-[4px_4px_0_rgba(0,0,0)] hover:drop-shadow-[0_0_0_rgba(0,0,0)]"),
22+
("box", "drop-shadow-[4px_4px_0_rgba(0,0,0)] hover:drop-shadow-[0_0_0_rgba(0,0,0)] dark:drop-shadow-none shadow-sm hover:drop-shadow-none dark:hover:shadow-lg shadow-black"),
23+
]);
24+
let sizes = HashMap::from([("tiny", "min-h-7"), ("normal", "h-9"), ("big", "h-12")]);
25+
let current_color = (*colors.get(&color).unwrap()).to_string();
26+
let current_size = (*sizes.get(&size).unwrap()).to_string();
27+
let shadow = (*shadows.get(&shadow).unwrap()).to_string();
28+
29+
view! {
30+
<a
31+
href=href
32+
target="_blank"
33+
class=format!(
34+
"tracking-wider text-center font-work-sans border border-black dark:border-white flex items-center px-4 transition w-full max-w-full sm:max-w-[20rem] gap-x-4 {} {} {} {} whitespace-nowrap",
35+
current_color,
36+
current_size,
37+
class,
38+
shadow,
39+
)
40+
>
41+
42+
{children()}
43+
</a>
44+
}
45+
}
46+

src/components/button_link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn ButtonLink(
1515
"primary",
1616
"bg-orange-200 dark:bg-transparent hover:bg-black hover:text-white",
1717
),
18-
("white", "bg-orange-100 dark:bg-transparent hover:bg-black"),
18+
("white", "bg-orange-100 dark:bg-transparent hover:bg-black hover:text-white"),
1919
]);
2020
let shadows = HashMap::from([
2121
("drop", "drop-shadow-[4px_4px_0_rgba(0,0,0)] hover:drop-shadow-[0_0_0_rgba(0,0,0)]"),

src/components/hacktoberfest.rs

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
use leptos::{component, view, IntoView};
2+
3+
use crate::components::{
4+
button_link::ButtonLink,
5+
button_large_link::ButtonLargeLink,
6+
icons::{DiscordIcon, CalendarIcon, GithubIcon},
7+
};
8+
9+
#[component]
10+
pub fn Hacktoberfest() -> impl IntoView {
11+
view! {
12+
<section class="bg-orange-200/30 dark:bg-transparent">
13+
<div class="container mx-auto px-4">
14+
<div class="flex flex-col items-center py-20 gap-y-6">
15+
<h2 class="text-4xl text-center mb-4">
16+
<span class="font-work-sans font-light">
17+
"🚀 ¡Únete a la celebración del"
18+
<span class="font-alfa-slab text-orange-500">" Hacktoberfest "</span>
19+
"con nosotros! 🚀"
20+
</span>
21+
</h2>
22+
<p class="text-center text-xl">
23+
"Este" <span class="text-orange-500 font-alfa-slab">" 28 de septiembre"</span>"
24+
, nuestro comunidad se une a este emocionante evento de programación.
25+
Aprovecha esta excelente oportunidad para contribuir a proyectos open-source, aprender nuevas habilidades
26+
y conectar con otros amantes del open-source."
27+
</p>
28+
<div class="flex items-center gap-x-12 gap-y-6 flex-col *:w-full sm:flex-row">
29+
<ButtonLink
30+
href="https://discord.gg/4ng5HgmaMg"
31+
shadow="box"
32+
color="white"
33+
size="big"
34+
>
35+
<DiscordIcon size=30/>
36+
"Participa"
37+
</ButtonLink>
38+
<ButtonLargeLink
39+
href="https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=M2ZiMjhzbGNqbTZoMjNrZ2ZpbW4zYzk1ZGUgZGFmYzYyODQwMzRkOWJlZjNlMzFkZTNiZDE1OTI2OGQ5OGU4YzlhOGY2MjU3Mzk4NGI3MGE1OWQ2NjU3ZjVhZkBn&tmsrc=dafc6284034d9bef3e31de3bd159268d98e8c9a8f62573984b70a59d6657f5af%40group.calendar.google.com"
40+
shadow="box"
41+
color="white"
42+
size="big"
43+
>
44+
<CalendarIcon size=30/>
45+
"Añade a tu calendario"
46+
</ButtonLargeLink>
47+
<ButtonLargeLink
48+
href="https://github.com/RustLangES"
49+
shadow="box"
50+
color="white"
51+
size="big"
52+
>
53+
<GithubIcon size=30/>
54+
"Postula tu proyecto"
55+
</ButtonLargeLink>
56+
</div>
57+
</div>
58+
</div>
59+
</section>
60+
}
61+
}

src/components/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
mod aprende;
22
mod button_link;
3+
mod button_large_link;
34
mod cards;
45
mod community_projects;
56
mod footer;
@@ -8,13 +9,15 @@ mod header;
89
mod hero;
910
mod icons;
1011
mod other_communities;
12+
mod hacktoberfest;
1113
mod our_communities;
1214
pub mod separator;
1315
mod slogan_button;
1416
mod sponsors;
1517

1618
pub use aprende::{Books, HeaderAprende, Roadmap, Youtube};
1719
pub use button_link::ButtonLink;
20+
pub use button_large_link::ButtonLargeLink;
1821
pub use cards::{CardTitle, CommunityCard, ContributorCard, ProjectCard};
1922
pub use community_projects::CommunityProjects;
2023
pub use footer::Footer;
@@ -25,6 +28,8 @@ pub use icons::{
2528
CloudflareIcon, DiscordIcon, GithubIcon, LinkedinIcon, LocationIcon, NextIcon, TelegramIcon,
2629
TwitterIcon,
2730
};
31+
32+
pub use hacktoberfest::Hacktoberfest;
2833
pub use other_communities::OtherCommunities;
2934
pub use our_communities::OurCommunities;
3035
pub use separator::Separator;

0 commit comments

Comments
 (0)