({
width,
height,
src,
alt,
caption,
light,
dark,
...props
}: ImgProps)
| 13 | } |
| 14 | |
| 15 | export default function Img({ |
| 16 | width, |
| 17 | height, |
| 18 | src, |
| 19 | alt, |
| 20 | caption, |
| 21 | light, |
| 22 | dark, |
| 23 | ...props |
| 24 | }: ImgProps) { |
| 25 | const finalAlt = alt || caption; |
| 26 | |
| 27 | return ( |
| 28 | <> |
| 29 | <Dialog> |
| 30 | <DialogTrigger asChild> |
| 31 | <figure |
| 32 | className="not-prose relative cursor-zoom-in" |
| 33 | style={{ marginBlock: '40px' }} |
| 34 | > |
| 35 | <div className="not-prose relative overflow-hidden rounded-xl bg-background p-2 ring-2 ring-border"> |
| 36 | <div className="relative flex h-full w-full justify-center overflow-hidden rounded-lg"> |
| 37 | {src && ( |
| 38 | <img |
| 39 | alt={finalAlt} |
| 40 | src={src} |
| 41 | width={width} |
| 42 | height={height} |
| 43 | style={{ |
| 44 | width: '100%', |
| 45 | height: 'auto', |
| 46 | color: 'transparent' |
| 47 | }} |
| 48 | className="block max-w-full rounded-md object-cover shadow" |
| 49 | /> |
| 50 | )} |
| 51 | {light && ( |
| 52 | <img |
| 53 | alt={finalAlt} |
| 54 | src={light} |
| 55 | loading="lazy" |
| 56 | width={width} |
| 57 | height={height} |
| 58 | style={{ |
| 59 | width: '100%', |
| 60 | height: 'auto', |
| 61 | color: 'transparent' |
| 62 | }} |
| 63 | className="block max-w-full rounded-md object-cover shadow dark:hidden" |
| 64 | /> |
| 65 | )} |
| 66 | {dark && ( |
| 67 | <img |
| 68 | alt={finalAlt} |
| 69 | src={dark} |
| 70 | loading="lazy" |
| 71 | width={width} |
| 72 | height={height} |
nothing calls this directly
no outgoing calls
no test coverage detected