import clsx from 'clsx'; import { cn } from 'lib/utils'; import Link from 'next/link'; type Text = { type: 'text'; value: string; bold?: boolean; }; type Content = | { type: 'paragraph'; children: Text[] } | Text | { type: 'list'; listType: 'bullet' | 'ordered' | 'unordered'; children: Array<{ type: 'listItem'; children: Text[] }>; } | { type: 'listItem'; children: Text[] } | { type: 'link'; children: Text[]; target: string; title: string; url: string } | { type: 'heading'; level: number; children: Text[]; }; const RichTextBlock = ({ block, className }: { block: Content; className?: string }) => { if (block.type === 'text') { return block.bold ? ( {block.value} ) : ( {block.value} ); } if (block.type === 'heading') { const Heading = `h${block.level}` as keyof JSX.IntrinsicElements; return ( {block.children.map((child, index) => ( ))} ); } if (block.type === 'link') { return ( {block.children[0]?.value || block.title} ); } if (block.type === 'listItem') { return block.children.map((child, index) => ); } if (block.type === 'list') { return (
    {block.children.map((child, index) => (
  1. ))}
); } return (

{block.children.map((child, index) => ( ))}

); }; const RichTextDisplay = ({ contentBlocks }: { contentBlocks: Content[] }) => { return (
{contentBlocks.map((block, index) => ( ))}
); }; export default RichTextDisplay;