forked from RustLangES/RustLangES.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathother_communities.rs
62 lines (58 loc) · 2.69 KB
/
other_communities.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use leptos::*;
use crate::{components::{CommunityCard, NextIcon}, extras::OTHER_COMUNITIES};
#[component]
pub fn OtherCommunities(#[prop(default = false)] show_more: bool) -> impl IntoView {
view! {
<section class="bg-orange-200 py-20">
<div class="container mx-auto px-4">
<h2 class="text-3xl text-left mb-6">
<span class="font-work-sans font-light">"Otras "</span>
<span class="font-alfa-slab text-orange-500">"Comunidades"</span>
<span class="font-work-sans font-light">" recomendadas "</span>
</h2>
<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">
{OTHER_COMUNITIES
.iter()
.take(if show_more { 5 } else { OTHER_COMUNITIES.len() })
.map(|item| {
let image_src = if cfg!(debug_assertions)
&& item.brand_src.starts_with("/gen_assets")
{
format!("/assets{}", item.brand_src)
} else {
item.brand_src.to_string()
};
view! {
<CommunityCard
name=item.name
description=item.description
link=item.link
icon=item.icon
brand_src=image_src
brand_alt=item.brand_alt
/>
}
})
.collect::<Vec<_>>()}
</div>
{if show_more {
view! {
<div class="w-full flex justify-end my-3">
<a
href="/comunidad"
class="text-black/80 hover:text-orange-500 fill-black/80 hover:fill-orange-500 font-work-sans font-light text-2xl flex justify-center items-center"
>
Ver todas las comunidades
<span class="inline-block ml-2">
<NextIcon class="fill-current" size=20/>
</span>
</a>
</div>
}
} else {
view! { <div></div> }
}}
</div>
</section>
}
}