'use client'; import { useState } from 'react'; import { Markdown } from '@/components/ui/Markdown'; import { cn } from '@/lib/cn'; import { LOCALE_LABELS, type LegalLocale } from '@/lib/legal'; interface LegalBodyProps { /** Canonical, governing content and its locale. */ content: string; locale: LegalLocale; /** Optional additional-language versions keyed by locale. */ translations?: Partial>; } /** * Renders a legal document's prose, with a language switcher when translated * versions exist. The canonical locale is shown first and remains the governing * text; other locales are convenience translations the reader can toggle to. */ export function LegalBody({ content, locale, translations }: LegalBodyProps) { const versions: Partial> = { [locale]: content, ...translations }; const available = Object.keys(versions) as LegalLocale[]; const [active, setActive] = useState(locale); return (
{available.length > 1 && (
{available.map((code) => ( ))}
)}
); }