NGU-Web/src/components/Logo.tsx
Zaldimmar 2ad65cdc15 Write the site in US English
color, center, canceled, labeled, recognize and the rest, in UI
text, help text, comments, docs and names (ColorInput, QrCenter).
Migration 053 renames the two Site settings color CHECKs, whose
names are the messages the admin shows. Kept: events.status's
stored value 'cancelled' (shown as canceled), aria-labelledby,
schema.org's EventCancelled, and old migrations as they ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 13:24:11 -05:00

30 lines
1.3 KiB
TypeScript

/* ═══════════════════════════════════════════════════════════════
LOGO
An <img> for a logo or mark that may not exist: no src, or a file
that 404s, and it draws `fallback` instead (initials, a color dot,
or nothing). `src` is already resolved (mediaUrl in media.ts). An
upload loads its 640px copy first (useSmallImage). Decorative by
default (alt ""), since a logo sits next to the name it stands for.
═══════════════════════════════════════════════════════════════ */
import type { ReactNode } from 'react'
import { useSmallImage } from '../lib/useSmallImage.ts'
export default function Logo({
src,
alt = '',
className,
fallback = null,
}: {
src?: string | null
alt?: string
className?: string
fallback?: ReactNode
}) {
const img = useSmallImage(src)
if (img.failed) return <>{fallback}</>
// logo-plate: a light backing in dark mode, for marks drawn for white.
return <img src={img.src} alt={alt} loading="lazy" className={`logo-plate ${className ?? ""}`} onError={img.onError} />
}