Skip to content

Commit 5e383e0

Browse files
committed
Add keynoter conditional link to speakers list.
1 parent 2d33f55 commit 5e383e0

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/components/keynoters/keynoter.astro

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
import type { ImageMetadata } from "astro";
3+
import { getCollection } from "astro:content";
34
import { Image } from "astro:assets";
45
import Person1 from "../placeholders/person-1.astro";
56
import Person2 from "../placeholders/person-2.astro";
@@ -19,6 +20,7 @@ export interface Props {
1920
2021
const {
2122
name,
23+
slug,
2224
tagline,
2325
image,
2426
placeholder,
@@ -30,10 +32,14 @@ const placeholders = [Person1, Person2, Person3, Person4, Person5];
3032
const Placeholder =
3133
placeholders[Math.floor(Math.random() * placeholders.length)];
3234
35+
36+
const entries = await getCollection("speakers");
37+
const isSpeaker = entries.some((entry) => entry.id === slug)
38+
3339
---
3440

3541
<li class:list={["list-none rounded-2xl overflow-clip flex group", className]}>
36-
<a class="block w-full h-full relative " >
42+
<div class="block w-full h-full relative " >
3743
<div class="relative aspect-[9/10] overflow-clip">
3844
{
3945
image ? (
@@ -56,16 +62,24 @@ const Placeholder =
5662
>
5763
{
5864
placeholder ? (
59-
<p class="text-body-inverted ">More keynoters coming soon</p>
65+
<p class="text-body-inverted">More keynoters coming soon</p>
6066
) : (
6167
<>
62-
<p class="text-[#17223A] font-bold">{name}</p>
63-
{tagline ? (
68+
{isSpeaker ? (
69+
<p class="text-[#17223A] font-bold">
70+
<a href={`/speaker/${slug}`} class="text-[#17223A] font-bold hover:underline">
71+
{name}
72+
</a>
73+
</p>
74+
) : (
75+
<p class="text-[#17223A] font-bold">{name}</p>
76+
)}
77+
{tagline && (
6478
<p class="text-secondary-hover text-lg italic">{tagline}</p>
65-
) : null}
79+
)}
6680
</>
6781
)
6882
}
6983
</div>
70-
</a>
84+
</div>
7185
</li>

0 commit comments

Comments
 (0)