blob: 0c1aae67c3fe5c8935be32e742f18d9d27e2353a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import Image from "next/image";
import { BookmarkMarkdownComponent } from "@/components/dashboard/bookmarks/BookmarkMarkdownComponent";
import { ScrollArea } from "@radix-ui/react-scroll-area";
import type { ZBookmarkTypeText } from "@karakeep/shared/types/bookmarks";
import { getAssetUrl } from "@karakeep/shared-react/utils/assetUtils";
import { BookmarkTypes, ZBookmark } from "@karakeep/shared/types/bookmarks";
export function TextContentSection({ bookmark }: { bookmark: ZBookmark }) {
if (bookmark.content.type != BookmarkTypes.TEXT) {
throw new Error("Invalid content type");
}
const banner = bookmark.assets.find(
(asset) => asset.assetType == "bannerImage",
);
return (
<ScrollArea className="h-full">
{banner && (
<div className="relative h-52 min-w-full">
<Image
alt="banner"
src={getAssetUrl(banner.id)}
width={0}
height={0}
layout="fill"
objectFit="cover"
/>
</div>
)}
<BookmarkMarkdownComponent>
{bookmark as ZBookmarkTypeText}
</BookmarkMarkdownComponent>
</ScrollArea>
);
}
|