Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 2x 2x | import { PropsWithChildren } from 'react'
import Image from 'next/image'
export interface ImageProps {
src: string
alt: string
width: number
height: number
}
export interface ExampleImageProps extends PropsWithChildren {
title?: string
imageProps: ImageProps
}
const ExampleImage = ({ children, title, imageProps }: ExampleImageProps) => {
return (
<>
{title && (
<p>
<strong>{title}</strong>
</p>
)}
<figure className="mb-6 rounded-lg border bg-white p-1 drop-shadow-lg md:w-3/5">
<Image
key={imageProps.src}
className="w-full"
alt={imageProps.alt}
src={imageProps.src}
width={imageProps.width}
height={imageProps.height}
/>
<figcaption className="px-5 py-3 text-lg">{children}</figcaption>
</figure>
</>
)
}
export default ExampleImage
|