|
1 | 1 | use leptos::*;
|
2 | 2 |
|
3 |
| -use crate::components::icons::GithubIcon; |
| 3 | +use crate::components::icons::{GithubIcon, TwitterIcon, LocationIcon}; |
4 | 4 |
|
5 | 5 | #[component]
|
6 | 6 | pub fn ContributorCard(
|
7 | 7 | #[prop(into)] name: String,
|
8 |
| - #[prop(into)] description: String, |
| 8 | + #[prop(into)] description: Option<String>, |
| 9 | + #[prop(into)] twitter: Option<String>, |
| 10 | + #[prop(into)] location: Option<String>, |
9 | 11 | #[prop(into)] link: String,
|
10 | 12 | #[prop(into)] brand_src: String,
|
11 | 13 | ) -> impl IntoView {
|
| 14 | + |
12 | 15 | view! {
|
13 | 16 | <article>
|
14 | 17 | <a
|
15 |
| - href=link |
| 18 | + href=link.clone() |
16 | 19 | target="_blank"
|
17 |
| - class="group flex flex-col gap-y-6 border border-black p-6 hover:bg-orange-500 bg-orange-100 drop-shadow-[0_0_0_rgba(0,0,0)] hover:drop-shadow-[-4px_-4px_0_rgba(0,0,0)] transition justify-between h-full" |
| 20 | + class="group flex flex-col gap-y-6 border border-black p-4 hover:bg-orange-500 bg-orange-100 drop-shadow-[0_0_0_rgba(0,0,0)] hover:drop-shadow-[-4px_-4px_0_rgba(0,0,0)] transition justify-between h-full" |
18 | 21 | >
|
19 | 22 | <div class="flex flex-col gap-y-2">
|
20 | 23 | <img src=brand_src width="60" class="rounded-full mb-4" alt=name.clone()/>
|
21 | 24 | <h2 class="font-work-sans text-black text-xl">{name.clone()}</h2>
|
| 25 | + {if let Some(location) = location.clone() { |
| 26 | + view! { |
| 27 | + <div class="flex gap-2 items-center bg-slate-200/20 rounded-md p-1"> |
| 28 | + <LocationIcon size=16/> |
| 29 | + <p class="font-work-sans text-black text-sm">{location}</p> |
| 30 | + </div> |
| 31 | + } |
| 32 | + } else { |
| 33 | + view! { <div class="hidden"></div> } |
| 34 | + }} |
| 35 | + |
22 | 36 | <p class="font-work-sans text-black">{description}</p>
|
23 | 37 | </div>
|
24 |
| - <span class="ml-auto"> |
25 |
| - <GithubIcon size=30/> |
| 38 | + <span class="ml-auto flex"> |
| 39 | + {if let Some(twitter) = twitter { |
| 40 | + view! { |
| 41 | + <div> |
| 42 | + <a href=format!("https://twitter.com/{}", twitter) target="_blank"> |
| 43 | + <TwitterIcon size=30/> |
| 44 | + </a> |
| 45 | + </div> |
| 46 | + } |
| 47 | + } else { |
| 48 | + view! { <div></div> } |
| 49 | + }} |
| 50 | + <a href=link.clone() target="_blank"> |
| 51 | + <GithubIcon size=30/> |
| 52 | + </a> |
26 | 53 | </span>
|
27 | 54 | </a>
|
28 | 55 | </article>
|
|
0 commit comments