Fixed some card styling so episode description can grow/shrink and show all the content. Added a footer

This commit is contained in:
Justin Walrath 2025-05-12 10:12:16 -04:00
parent 1b729df778
commit 0335fb2b43
2 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import Image from 'next/image'; import Image from 'next/image';
import { PodcastDto } from '../../../common/dtos/podcastDto'; import { PodcastDto } from '../../../common/dtos/podcastDto';
import { useState } from 'react';
export default function PodcastCard({ export default function PodcastCard({
imageUrl = "https://placehold.co/400", imageUrl = "https://placehold.co/400",
@ -9,15 +10,28 @@ export default function PodcastCard({
url, url,
author, author,
}: PodcastDto) { }: PodcastDto) {
const [descriptionExpanded, setDescriptionExpanded] = useState(false),
toggleExpand = () => {
setDescriptionExpanded(!descriptionExpanded);
};
return ( return (
<div className="w-full h-[150px] shadow-md rounded-sm overflow-hidden flex m-4 mb-1"> <div className="w-full min-h-[150px] shadow-md rounded-sm overflow-hidden flex m-4 mb-1">
<div className="w-[150px] h-full bg-purple-100 flex-shrink-0 relative"> <div className="w-[150px] h-full bg-purple-100 flex-shrink-0 relative">
<Image unoptimized src={imageUrl} alt={title ?? ''} layout="fill" objectFit="contain" /> <Image unoptimized src={imageUrl} alt={title ?? ''} layout="fill" objectFit="contain" />
</div> </div>
<div className="p-4 flex-grow flex flex-col bg-purple-200"> <div className="p-4 flex-grow flex flex-col bg-purple-200">
<h2 className="text-lg font-bold text-gray-800">{title}</h2> <h2 className="text-lg font-bold text-gray-800">{title}</h2>
<p className="text-sm text-gray-600 flex-grow">{description}</p> <div
className={`text-sm text-gray-600 overflow-hidden transition-all duration-300 ${descriptionExpanded ? 'max-h-full' : 'max-h-[30px]'
}`}
>
{description}
</div>
<button onClick={toggleExpand} className="mt-2 text-center text-blue-500 hover:underline text-sm self-center">
{descriptionExpanded ? 'Show Less' : 'Show More'}
</button>
<div className="mt-2 text-sm text-gray-500"> <div className="mt-2 text-sm text-gray-500">
<p>By: {author}</p> <p>By: {author}</p>
<p>Uploaded: {uploadDate}</p> <p>Uploaded: {uploadDate}</p>

View File

@ -21,6 +21,9 @@ export default function Main({ children }: MainProps) {
<main className="flex-grow"> <main className="flex-grow">
{children} {children}
</main> </main>
<footer className="bg-purple-300 py-4">
<p className="text-right text-sm pr-4">© 2025 Ever Givin Pod</p>
</footer>
</div> </div>
) )
} }