import { cn } from "@/lib/utils";
import { toRichTextHtml } from "@/lib/rich-text";

export default function RichTextContent({
  className,
  html,
}: {
  className?: string;
  html: string;
}) {
  return (
    <div
      className={cn(
        "prose prose-slate max-w-none [&_a]:text-accent [&_a]:underline-offset-4 hover:[&_a]:text-accent/80 [&_blockquote]:border-l-4 [&_blockquote]:border-accent/30 [&_blockquote]:pl-4 [&_h2]:font-display [&_h2]:text-primary [&_h3]:font-display [&_h3]:text-primary [&_li]:text-muted-foreground [&_ol]:pl-5 [&_p]:text-muted-foreground [&_p]:leading-relaxed [&_strong]:text-foreground [&_ul]:pl-5",
        className,
      )}
      dangerouslySetInnerHTML={{ __html: toRichTextHtml(html) }}
    />
  );
}
