Skip to content

Commit 6a9495d

Browse files
author
Alex Patterson
committed
add buttons
1 parent 2442502 commit 6a9495d

5 files changed

Lines changed: 83 additions & 5 deletions

File tree

‎app/(main)/(podcast)/podcast/[slug]/page.tsx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import SponsorCard from "@/components/sponsor-card";
1818
import Avatar from "@/components/avatar";
1919
import Picks from "./picks";
2020
import PlayerPlayButton from "@/components/player-play-button";
21+
import PodcastOpenSpotify from "@/components/podcast-open-spotify";
22+
import PodcastOpenApple from "@/components/podcast-open-apple";
23+
import PodcastOpenYouTube from "@/components/podcast-open-youtube";
2124

2225
type Props = {
2326
params: { slug: string };
@@ -109,8 +112,15 @@ export default async function PodcastPage({ params }: Props) {
109112
<DateComponent dateString={podcast.date} />
110113
</div>
111114
{src && (
112-
<div className="flex justify-start flex-wrap w-full">
115+
<div className="flex flex-col sm:flex-row justify-start flex-wrap w-full p-2 sm:p-4 border border-foreground gap-2 sm:gap-4 items-center">
116+
<h2 className="text-xl font-bold w-full text-center sm:text-start">Listening Options</h2>
113117
<PlayerPlayButton podcast={podcast} />
118+
<span className="text-xl">or</span>
119+
<div className="flex gap-1">
120+
<PodcastOpenSpotify podcast={podcast} />
121+
<PodcastOpenApple />
122+
<PodcastOpenYouTube podcast={podcast} />
123+
</div>
114124
</div>
115125
)}
116126
</div>

‎components/player-play-button.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ export default function PlayerPlayButton({ podcast }: { podcast: NonNullable<Pod
2222
return (
2323
<>
2424
{currentPodcast?._id === podcast?._id && audio?.isPlaying ? (
25-
<Button variant="ghost" onClick={() => audioRef.current?.pause()} className="flex gap-2">
25+
<Button variant="default" onClick={() => audioRef.current?.pause()} className="flex gap-2">
2626
<FaCirclePause className="h-5 w-5" />
27-
<div className="text-xl">Play Episode</div>
27+
<div className="text-xl">Pause Episode</div>
2828
</Button>
2929
) :
3030
(
31-
<Button variant="ghost" onClick={setCurrent} className="flex gap-2">
31+
<Button variant="default" onClick={setCurrent} className="flex gap-2">
3232
<FaPlay className="h-5 w-5" />
33-
<div className="text-xl">Pause Episode</div>
33+
<div className="text-xl">Play Episode</div>
3434
</Button>
3535
)
3636
}

‎components/podcast-open-apple.tsx‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"use client"
2+
import { Button } from "@/components/ui/button"
3+
import { PodcastQueryResult } from "@/sanity.types";
4+
import Link from "next/link";
5+
import { SiApplepodcasts } from "react-icons/si";
6+
7+
export default function PodcastOpenApple() {
8+
return (
9+
<Button variant="ghost" className="flex gap-2" asChild>
10+
<Link
11+
href={`https://podcasts.apple.com/us/podcast/codingcat-dev-podcast/id1491655542`}
12+
target="_blank"
13+
rel="noreferrer"
14+
aria-label="Listen on Spotify"
15+
>
16+
<SiApplepodcasts className="h-5 w-5" />
17+
</Link>
18+
</Button>
19+
)
20+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"use client"
2+
import { Button } from "@/components/ui/button"
3+
import { FaSpotify } from "react-icons/fa6";
4+
import { PodcastQueryResult } from "@/sanity.types";
5+
import Link from "next/link";
6+
7+
export default function PodcastOpenSpotify({ podcast }: { podcast: NonNullable<PodcastQueryResult> }) {
8+
return (
9+
<>
10+
{podcast?._id && (
11+
<Button variant="ghost" className="flex gap-2" asChild>
12+
<Link
13+
href={`https://open.spotify.com/search/codingcat.dev%20${encodeURIComponent(podcast.title)}/episodes`}
14+
target="_blank"
15+
rel="noreferrer"
16+
aria-label="Listen on Spotify"
17+
>
18+
<FaSpotify className="h-5 w-5" />
19+
</Link>
20+
</Button>
21+
)}
22+
</>
23+
)
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"use client"
2+
import { Button } from "@/components/ui/button"
3+
import { FaYoutube } from "react-icons/fa6";
4+
import { PodcastQueryResult } from "@/sanity.types";
5+
import Link from "next/link";
6+
7+
export default function PodcastOpenYouTube({ podcast }: { podcast: NonNullable<PodcastQueryResult> }) {
8+
return (
9+
<>
10+
{podcast?.youtube && (
11+
<Button variant="ghost" className="flex gap-2" asChild>
12+
<Link
13+
href={podcast.youtube}
14+
target="_blank"
15+
rel="noreferrer"
16+
aria-label="Listen on Spotify"
17+
>
18+
<FaYoutube className="h-5 w-5" />
19+
</Link>
20+
</Button>
21+
)}
22+
</>
23+
)
24+
}

0 commit comments

Comments
 (0)