mirror of
https://github.com/ershisan99/podcaster.git
synced 2025-12-16 20:59:26 +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,
|
||||
useTopPodcastsQuery,
|
||||
} from "../services/podcasts/podcast.hooks";
|
||||
import { PodcastInfoCard } from "../components/podcast-info-card";
|
||||
|
||||
export function Podcast() {
|
||||
const { podcastId } = useParams<{ podcastId: string }>();
|
||||
@@ -28,12 +29,12 @@ export function Podcast() {
|
||||
// TODO: break into smaller components
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<h1>{podcast.title}</h1>
|
||||
<h2>{podcast.author}</h2>
|
||||
<img src={episodesData?.podcast?.images.large} alt={podcast.title} />
|
||||
<p>{podcast.description}</p>
|
||||
</div>
|
||||
<PodcastInfoCard
|
||||
author={podcast.author}
|
||||
title={podcast.title}
|
||||
description={podcast.description}
|
||||
imageURL={episodesData?.podcast.images.large ?? ""}
|
||||
/>
|
||||
<div>Episodes: {episodesData?.podcast.trackCount}</div>
|
||||
<div>
|
||||
<table>
|
||||
|
||||
Reference in New Issue
Block a user