import type { SubheadBlock as SubheadBlockData } from '@/marketing/cms-types';
import { SanitizedHtmlInline } from '@/marketing/sanitized-html';

const ALIGN_CLASS: Record<NonNullable<SubheadBlockData['align']>, string> = {
    left: 'text-left',
    center: 'text-center',
};

export default function SubheadBlock({ block }: { block: SubheadBlockData }) {
    const align = ALIGN_CLASS[block.align ?? 'left'];

    return (
        <p className={`mt-4 first:mt-0 text-lg leading-relaxed text-muted-foreground ${align}`}>
            <SanitizedHtmlInline html={block.html} />
        </p>
    );
}
