Lumen & Gesso / website · lumengesso.com / app / components / MPhoto.tsx
| 1 | import type { CSSProperties } from 'react'; |
| 2 | |
| 3 | type MPhotoProps = { |
| 4 | label: string; |
| 5 | meta?: string; |
| 6 | ratio?: string; |
| 7 | dark?: boolean; |
| 8 | src?: string; |
| 9 | alt?: string; |
| 10 | style?: CSSProperties; |
| 11 | }; |
| 12 | |
| 13 | // Stand-in for real customer photography. Looks like an obvious "photo slot" |
| 14 | // — corner badge + caption — so the page reads as "real photo goes here" |
| 15 | // rather than as final art. Pass `src` to render an actual image instead. |
| 16 | export function MPhoto({ label, meta, ratio = '4/5', dark = false, src, alt, style }: MPhotoProps) { |
| 17 | return ( |
| 18 | <div |
| 19 | className={`mphoto${dark ? ' mphoto--dark' : ''}`} |
| 20 | style={{ aspectRatio: ratio, ...style }} |
| 21 | > |
| 22 | {src ? ( |
| 23 | // eslint-disable-next-line @next/next/no-img-element |
| 24 | <img src={src} alt={alt ?? label} className="mphoto__img" /> |
| 25 | ) : ( |
| 26 | <div className="mphoto__wash" aria-hidden="true" /> |
| 27 | )} |
| 28 | <div className="mphoto__badge"> |
| 29 | <svg width="14" height="11" viewBox="0 0 14 11" fill="none" stroke="currentColor" strokeWidth="1"> |
| 30 | <rect x=".5" y="2.5" width="13" height="8" /> |
| 31 | <path d="M4 2.5V1.5h3v1" /> |
| 32 | <circle cx="7" cy="6.5" r="2" /> |
| 33 | </svg> |
| 34 | <span>Photo</span> |
| 35 | </div> |
| 36 | <div className="mphoto__caption"> |
| 37 | <div className="mphoto__label">{label}</div> |
| 38 | {meta && <div className="mphoto__meta">{meta}</div>} |
| 39 | </div> |
| 40 | </div> |
| 41 | ); |
| 42 | } |