mirror of
https://github.com/ershisan99/podcaster.git
synced 2025-12-17 20:59:27 +00:00
chore: refactor podcast info into a separate component
This commit is contained in:
22
src/components/podcast-info-card.tsx
Normal file
22
src/components/podcast-info-card.tsx
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
type Props = {
|
||||||
|
title: string;
|
||||||
|
author: string;
|
||||||
|
description: string;
|
||||||
|
imageURL: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const PodcastInfoCard = ({
|
||||||
|
title,
|
||||||
|
author,
|
||||||
|
description,
|
||||||
|
imageURL,
|
||||||
|
}: Props) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h1>{title}</h1>
|
||||||
|
<h2>{author}</h2>
|
||||||
|
<img src={imageURL} alt={title} />
|
||||||
|
<p>{description}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
usePodcastEpisodesQuery,
|
usePodcastEpisodesQuery,
|
||||||
useTopPodcastsQuery,
|
useTopPodcastsQuery,
|
||||||
} from "../services/podcasts/podcast.hooks";
|
} from "../services/podcasts/podcast.hooks";
|
||||||
|
import { PodcastInfoCard } from "../components/podcast-info-card";
|
||||||
|
|
||||||
export function Podcast() {
|
export function Podcast() {
|
||||||
const { podcastId } = useParams<{ podcastId: string }>();
|
const { podcastId } = useParams<{ podcastId: string }>();
|
||||||
@@ -28,12 +29,12 @@ export function Podcast() {
|
|||||||
// TODO: break into smaller components
|
// TODO: break into smaller components
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<PodcastInfoCard
|
||||||
<h1>{podcast.title}</h1>
|
author={podcast.author}
|
||||||
<h2>{podcast.author}</h2>
|
title={podcast.title}
|
||||||
<img src={episodesData?.podcast?.images.large} alt={podcast.title} />
|
description={podcast.description}
|
||||||
<p>{podcast.description}</p>
|
imageURL={episodesData?.podcast.images.large ?? ""}
|
||||||
</div>
|
/>
|
||||||
<div>Episodes: {episodesData?.podcast.trackCount}</div>
|
<div>Episodes: {episodesData?.podcast.trackCount}</div>
|
||||||
<div>
|
<div>
|
||||||
<table>
|
<table>
|
||||||
|
|||||||
Reference in New Issue
Block a user