blob: 4d6bb976974aeae545a33676f6958f0e85f26ae6 (
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
37
38
39
40
41
42
|
import Image from "next/image";
import Link from "next/link";
import type { ZBookmark } from "@hoarder/shared/types/bookmarks";
export function AssetContentSection({ bookmark }: { bookmark: ZBookmark }) {
if (bookmark.content.type != "asset") {
throw new Error("Invalid content type");
}
switch (bookmark.content.assetType) {
case "image": {
return (
<div className="relative h-full min-w-full">
<Link
href={`/api/assets/${bookmark.content.assetId}`}
target="_blank"
>
<Image
alt="asset"
fill={true}
className="object-contain"
src={`/api/assets/${bookmark.content.assetId}`}
/>
</Link>
</div>
);
}
case "pdf": {
return (
<iframe
title={bookmark.content.assetId}
className="h-full w-full"
src={`/api/assets/${bookmark.content.assetId}`}
/>
);
}
default: {
return <div>Unsupported asset type</div>;
}
}
}
|