Skip to content

Commit e083e37

Browse files
Copilotargyleink
andcommitted
Add no episodes placeholder to EpisodeList component
Co-authored-by: argyleink <1134620+argyleink@users.noreply.github.com>
1 parent cbdf338 commit e083e37

1 file changed

Lines changed: 57 additions & 51 deletions

File tree

src/components/EpisodeList.astro

Lines changed: 57 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -12,61 +12,67 @@ export interface Props {
1212
const { episodes, show } = Astro.props;
1313
---
1414

15-
<ul aria-label="EpisodeList">
16-
{
17-
episodes.map((episode) => {
18-
return (
19-
<li class="dark:border-dark-border border-b">
20-
<div class="flex w-full flex-col py-12 lg:flex-row">
21-
<img
22-
alt={`${episode.title} - episode art`}
23-
aria-hidden="true"
24-
class="mb-3 block h-20 w-20 rounded-md lg:mr-6"
25-
height={80}
26-
loading="lazy"
27-
src={episode.episodeThumbnail ?? show.image}
28-
width={80}
29-
/>
15+
{
16+
episodes.length === 0 ? (
17+
<p class="py-12 text-center text-lg">
18+
No episodes yet. Check back soon!
19+
</p>
20+
) : (
21+
<ul aria-label="EpisodeList">
22+
{episodes.map((episode) => {
23+
return (
24+
<li class="dark:border-dark-border border-b">
25+
<div class="flex w-full flex-col py-12 lg:flex-row">
26+
<img
27+
alt={`${episode.title} - episode art`}
28+
aria-hidden="true"
29+
class="mb-3 block h-20 w-20 rounded-md lg:mr-6"
30+
height={80}
31+
loading="lazy"
32+
src={episode.episodeThumbnail ?? show.image}
33+
width={80}
34+
/>
3035

31-
<div class="flex flex-col">
32-
<FormattedDate date={new Date(episode.published)} />
36+
<div class="flex flex-col">
37+
<FormattedDate date={new Date(episode.published)} />
3338

34-
<h2 class="text-light-text-heading my-2 text-lg font-bold dark:text-white">
35-
<a
36-
href={`/${episode.episodeSlug}`}
37-
style={
38-
'view-transition-name: var(--should-vt); --vt-name: vt-' +
39-
dasherize(episode.title)
40-
}
41-
>
42-
{episode.episodeNumber}: {episode.title}
43-
</a>
44-
</h2>
39+
<h2 class="text-light-text-heading my-2 text-lg font-bold dark:text-white">
40+
<a
41+
href={`/${episode.episodeSlug}`}
42+
style={
43+
'view-transition-name: var(--should-vt); --vt-name: vt-' +
44+
dasherize(episode.title)
45+
}
46+
>
47+
{episode.episodeNumber}: {episode.title}
48+
</a>
49+
</h2>
4550

46-
<p class="mb-5">{episode.description}</p>
51+
<p class="mb-5">{episode.description}</p>
4752

48-
<div class="flex items-center gap-6 text-sm">
49-
<FullPlayButton
50-
client:visible
51-
episode={{
52-
audio: episode.audio,
53-
episodeNumber: episode.episodeNumber,
54-
id: episode.id,
55-
title: episode.title
56-
}}
57-
/>
53+
<div class="flex items-center gap-6 text-sm">
54+
<FullPlayButton
55+
client:visible
56+
episode={{
57+
audio: episode.audio,
58+
episodeNumber: episode.episodeNumber,
59+
id: episode.id,
60+
title: episode.title
61+
}}
62+
/>
5863

59-
<a
60-
class="text-light-text-heading font-bold dark:text-white"
61-
href={`/${episode.episodeSlug}`}
62-
>
63-
Show notes
64-
</a>
64+
<a
65+
class="text-light-text-heading font-bold dark:text-white"
66+
href={`/${episode.episodeSlug}`}
67+
>
68+
Show notes
69+
</a>
70+
</div>
6571
</div>
6672
</div>
67-
</div>
68-
</li>
69-
);
70-
})
71-
}
72-
</ul>
73+
</li>
74+
);
75+
})}
76+
</ul>
77+
)
78+
}

0 commit comments

Comments
 (0)