Image Card

image
Image
components/ui/image-card.tsx
type Props = {
imageUrl: string
caption: string
}
export default function ImageCard({ imageUrl, caption }: Props) {
return (
<figure className="w-[250px] overflow-hidden rounded-base border-2 border-border dark:border-darkBorder bg-main font-base shadow-light dark:shadow-dark">
<img className="w-full aspect-[4/3]" src={imageUrl} alt="image" />
<figcaption className="border-t-2 text-text border-border dark:border-darkBorder p-4">
{caption}
</figcaption>
</figure>
)
}

Usage

import ImageCard from '@/components/ui/image-card'

<ImageCard
caption="Image"
imageUrl="https://hips.hearstapps.com/hmg-prod/images/flowers-trees-and-bushes-reach-their-peak-of-full-bloom-in-news-photo-1678292967.jpg?resize=300:*"
></ImageCard>
Edit this page