39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
/* ═══════════════════════════════════════════════════════════════
|
|
ORG LOGO
|
|
|
|
An organization's logo, or its initials in a square in its color
|
|
when there's no file or it fails to load. Decorative: the name is
|
|
always right beside it. Used by the organization lists and the
|
|
group map.
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
import Logo from './Logo.tsx'
|
|
import { accentText } from '../lib/color.ts'
|
|
import { mediaUrl } from '../lib/media.ts'
|
|
import { initialsFor } from '../lib/organizations.ts'
|
|
|
|
export default function OrgLogo({
|
|
org,
|
|
color,
|
|
size = 'h-14 w-14',
|
|
}: {
|
|
org: { logo?: string | null; name: string }
|
|
color: string
|
|
size?: string
|
|
}) {
|
|
return (
|
|
<Logo
|
|
src={mediaUrl(org.logo)}
|
|
className={`${size} object-contain shrink-0`}
|
|
fallback={
|
|
<span
|
|
className={`${size} shrink-0 flex items-center justify-center font-display font-bold`}
|
|
style={{ border: `1px solid ${color}`, color: accentText(color) }}
|
|
aria-hidden="true"
|
|
>
|
|
{initialsFor(org.name)}
|
|
</span>
|
|
}
|
|
/>
|
|
)
|
|
}
|