aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard/preview/TextContentSection.tsx
blob: eba7d28b4b05c03c14a402f1e765d9391deaa8b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { ScrollArea } from "@radix-ui/react-scroll-area";
import Markdown from "react-markdown";

import type { ZBookmark } from "@hoarder/shared/types/bookmarks";

export function TextContentSection({ bookmark }: { bookmark: ZBookmark }) {
  if (bookmark.content.type != "text") {
    throw new Error("Invalid content type");
  }
  return (
    <ScrollArea className="h-full">
      <Markdown className="prose mx-auto dark:prose-invert">
        {bookmark.content.text}
      </Markdown>
    </ScrollArea>
  );
}