summaryrefslogtreecommitdiff
path: root/apps/web/src/components/ui/prose.tsx
blob: c25a5a65ae5a0d8bae7a4c99803b89079bb7c799 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { cn } from "@/lib/utils";
import type React from "react";

type ProseProps = React.HTMLAttributes<HTMLElement> & {
  as?: "article";
  html: string;
};

function Prose({ children, html, className }: ProseProps) {
  return (
    <article
      className={cn(
        "prose prose-h2:font-semibold max-w-none prose-h1:text-xl prose-a:text-blue-600 prose-p:text-justify dark:prose-invert mx-auto",
        className
      )}
    >
      {html ? <div dangerouslySetInnerHTML={{ __html: html }} /> : children}
    </article>
  );
}

export default Prose;