/* ═══════════════════════════════════════════════════════════════ ORG CONTACT An organization's ways to reach it, as buttons: its action links filled in its accent, then its website, email and socials outlined. Nothing at all when it has none. Used on an organization's page and on the Organization page (NGU's own). A platform's icon has its name beside it for screen readers and reading mode, unless the label already says it (PlatformName). ═══════════════════════════════════════════════════════════════ */ import PlatformIcon from './PlatformIcon.tsx' import type { OrganizationRecord } from '../lib/useContent.ts' import { accentText } from '../lib/color.ts' import { PLATFORMS } from '../lib/platforms.ts' function PlatformName({ platform, label }: { platform?: string | null; label?: string | null }) { const name = PLATFORMS.find((p) => p.id === platform)?.label if (!name || label?.toLowerCase().includes(name.toLowerCase())) return null return {label ? `${name}: ` : name} } export default function OrgContact({ org, accent }: { org: OrganizationRecord; accent: string }) { const hasAny = org.links.length > 0 || org.socials.length > 0 || org.websites.length > 0 || org.emails.length > 0 if (!hasAny) return null return (
{org.links.map((link) => ( {link.label} ))} {/* Every website and email row, each its own button with its own label; an email's url is the bare address (splitLinks in shape.js). */} {[ ...org.websites, ...org.emails.map((link) => ({ ...link, url: `mailto:${link.url}` })), ...org.socials, ].map((link) => ( {link.label} ))}
) }