Skip to content

Commit fa246b4

Browse files
committed
feat: import and use generated variables
1 parent e47f7de commit fa246b4

File tree

2 files changed

+6
-150
lines changed

2 files changed

+6
-150
lines changed

src/components/community_projects.rs

Lines changed: 3 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,18 @@
11
use leptos::*;
22

3-
use crate::components::cards::project_card::ProjectCard;
4-
5-
struct ProjectItem {
6-
name: Vec<&'static str>,
7-
description: &'static str,
8-
link: &'static str,
9-
brand_src: &'static str,
10-
button_link: &'static str,
11-
button_text: &'static str,
12-
brand_as_letter: bool,
13-
button_bg_color: &'static str,
14-
}
3+
use crate::{components::cards::project_card::ProjectCard, extras::COMUNITY_PROJECTS};
154

165
#[component]
176
pub fn CommunityProjects() -> impl IntoView {
18-
let items: Vec<ProjectItem> = vec![
19-
ProjectItem {
20-
name: vec!["Rust ", "Lang en Español"],
21-
description: "Pagina de la comunidad de Rust en Español",
22-
link: "https://github.com/RustLangES/rust-book-es",
23-
brand_src: "https://www.rust-lang.org/static/images/rust-logo-blk.svg",
24-
button_link: "https://github.com/RustLangES",
25-
button_text: "",
26-
brand_as_letter: false,
27-
button_bg_color: "white",
28-
},
29-
ProjectItem {
30-
name: vec!["The ", "Rust", " Programming Language [Spanish Ed.]"],
31-
description: "Traducción del libro oficial de Rust al español",
32-
link: "https://github.com/RustLangES/rust-book-es",
33-
brand_src: "./RustLogo-min.png",
34-
button_link: "https://github.com/RustLangES",
35-
button_text: "Rust Lang en Español",
36-
brand_as_letter: false,
37-
button_bg_color: "white",
38-
},
39-
ProjectItem {
40-
name: vec!["Hereditary"],
41-
description: "Una libreria para emular herencia en Rust",
42-
link: "https://github.com/datapture/hereditary",
43-
brand_src: "H",
44-
button_link: "https://github.com/superoptimo",
45-
button_text: "Francisco Leon",
46-
brand_as_letter: true,
47-
button_bg_color: "black",
48-
},
49-
ProjectItem {
50-
name: vec!["gabble"],
51-
description: "Un sistema de chats en tiempo real",
52-
link: "https://github.com/whizzes/gabble",
53-
brand_src: "🎎",
54-
button_link: "https://github.com/EstebanBorai",
55-
button_text: "Esteban Borai",
56-
brand_as_letter: true,
57-
button_bg_color: "white",
58-
},
59-
ProjectItem {
60-
name: vec!["Graphul"],
61-
description: "Un framework web basado en Axum",
62-
link: "https://graphul-rs.github.io",
63-
brand_src: "./graphul.webp",
64-
button_link: "https://github.com/SamuelBonilla",
65-
button_text: "Samuel Bonilla",
66-
brand_as_letter: false,
67-
button_bg_color: "black",
68-
},
69-
ProjectItem {
70-
name: vec!["http-server"],
71-
description: "Un command line HTTP server simple y configurable",
72-
link: "https://github.com/http-server-rs/http-server",
73-
brand_src: "https://github.com/http-server-rs/http-server/raw/main/assets/logo.svg",
74-
button_link: "https://github.com/EstebanBorai",
75-
button_text: "Esteban Borai",
76-
brand_as_letter: false,
77-
button_bg_color: "white",
78-
},
79-
ProjectItem {
80-
name: vec!["Freya"],
81-
description: "Una libreria para hacer GUI nativas utilizando Dioxus y Skia",
82-
link: "https://github.com/marc2332/freya",
83-
brand_src: "https://github.com/marc2332/freya/raw/main/logo.svg",
84-
button_link: "https://github.com/marc2332",
85-
button_text: "Marc Espín",
86-
brand_as_letter: false,
87-
button_bg_color: "white",
88-
},
89-
];
90-
917
view! {
928
<section class="bg-orange-200 py-20">
939
<div class="container mx-auto px-4">
9410
<h2 class="text-3xl text-left mb-6">
9511
<span class="font-work-sans font-light">"Proyectos de la "</span>
9612
<span class="font-alfa-slab text-orange-500">"Comunidad"</span>
9713
</h2>
98-
<div class="w-full grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 sm:gap-x-8 gap-y-8">
99-
{items
14+
<div class="w-full grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 sm:gap-x-8 gap-y-4">
15+
{COMUNITY_PROJECTS
10016
.into_iter()
10117
.map(|item| {
10218
view! {

src/components/other_communities.rs

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,9 @@
11
use leptos::*;
22

3-
use crate::components::cards::community_card::CommunityCard;
4-
5-
struct CommunityItem {
6-
name: Vec<&'static str>,
7-
description: &'static str,
8-
link: &'static str,
9-
icon: &'static str,
10-
brand_src: &'static str,
11-
brand_alt: &'static str,
12-
}
3+
use crate::{components::cards::community_card::CommunityCard, extras::OTHER_COMUNITIES};
134

145
#[component]
156
pub fn OtherCommunities() -> impl IntoView {
16-
let items: Vec<CommunityItem> = vec![
17-
CommunityItem {
18-
name: vec!["Rust ", "Barcelona"],
19-
description: "Comunidad de Rust en Barcelona",
20-
link: "https://discord.gg/DeZKCCyMcq",
21-
icon: "discord",
22-
brand_src: "./RustBCN.webp",
23-
brand_alt: "Logo de Rust Barcelona",
24-
},
25-
CommunityItem {
26-
name: vec!["Whizzles"],
27-
description: "Comunidad de Open Source con fuertes raices en Rust.",
28-
link: "https://discord.gg/b9EbVnSkuw",
29-
icon: "discord",
30-
brand_src: "./Whizzles.webp",
31-
brand_alt: "Logo de Whizzles",
32-
},
33-
CommunityItem {
34-
name: vec!["Rust", "MX"],
35-
description: "Comunidad de Rust en Mexico",
36-
link: "https://t.me/RustMX",
37-
icon: "telegram",
38-
brand_src: "./RustMX-min.png",
39-
brand_alt: "Logo de RustMX",
40-
},
41-
CommunityItem {
42-
name: vec!["Aprende ", "Rust"],
43-
description: "Comunidad de Rust en Mexico",
44-
link: "https://t.me/aprenderrust",
45-
icon: "telegram",
46-
brand_src: "./aprender-rust-min.jpg",
47-
brand_alt: "Logo de Aprende Rust",
48-
},
49-
CommunityItem {
50-
name: vec!["Rust ", "Español"],
51-
description: "Anteriormente Rust Argentina, hoy una comunidad internacional.",
52-
link: "https://t.me/rust_lang_es",
53-
icon: "telegram",
54-
brand_src: "./RustGeneral.jpg",
55-
brand_alt: "Logo de Rust Español",
56-
},
57-
CommunityItem {
58-
name: vec!["Salamandra ", "Devs"],
59-
description: "Comunidad de Programación en general.",
60-
link: "https://t.me/salamandradevs",
61-
icon: "telegram",
62-
brand_src: "./Salamandra.png",
63-
brand_alt: "Logo de Salamandra Devs",
64-
},
65-
];
66-
677
view! {
688
<section class="bg-orange-100 py-20">
699
<div class="container mx-auto px-4">
@@ -73,12 +13,12 @@ pub fn OtherCommunities() -> impl IntoView {
7313
<span class="font-work-sans font-light">" recomendadas "</span>
7414
</h2>
7515
<div class="w-full grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-x-8 gap-y-8">
76-
{items
16+
{OTHER_COMUNITIES
7717
.into_iter()
7818
.map(|item| {
7919
view! {
8020
<CommunityCard
81-
name=item.name.clone()
21+
name=item.name
8222
description=item.description
8323
link=item.link
8424
icon=item.icon

0 commit comments

Comments
 (0)