Mirror of https://forge.levinkeller.de/levin/dorfarchiv.git
3dc8f353899c33f97e1fa306f43dcc9c767f0b17
23 lines · 696 B
| 1 | import styles from './styles.module.css'; |
| 2 | |
| 3 | export default function ImageFigure({ src, alt, artist, copyright, rights, children }) { |
| 4 | const metadata = []; |
| 5 | if (artist) metadata.push(`Foto: ${artist}`); |
| 6 | if (copyright) metadata.push(copyright); |
| 7 | |
| 8 | const caption = metadata.join(' | '); |
| 9 | |
| 10 | return ( |
| 11 | <figure className={styles.imageWithCaption}> |
| 12 | {children ? children : <img src={src} alt={alt} loading="lazy" decoding="async" />} |
| 13 | <figcaption className={styles.imageCaption}> |
| 14 | {caption} |
| 15 | {rights && ( |
| 16 | <> |
| 17 | {' '}(<a href={rights} target="_blank" rel="noopener noreferrer">Lizenz</a>) |
| 18 | </> |
| 19 | )} |
| 20 | </figcaption> |
| 21 | </figure> |
| 22 | ); |
| 23 | } |