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) => (