20 lines
547 B
TypeScript
20 lines
547 B
TypeScript
import * as React from "react"
|
|
import { cn } from "@/lib/utils"
|
|
import { sanitizeHtml } from "@/lib/sanitize-html"
|
|
|
|
export interface HtmlDisplayProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
html?: string | null;
|
|
}
|
|
|
|
export function HtmlDisplay({ html, className, ...props }: HtmlDisplayProps) {
|
|
if (!html) return null;
|
|
|
|
return (
|
|
<div
|
|
className={cn("prose prose-sm dark:prose-invert max-w-none [&>p]:m-0 leading-snug", className)}
|
|
dangerouslySetInnerHTML={{ __html: sanitizeHtml(html) }}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|