blob: 94bd16cea226feed7a29ec1098240eb9a26d5faa (
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 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">
<Image
alt="asset"
fill={true}
className="object-contain"
src={`/api/assets/${bookmark.content.assetId}`}
/>
</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>;
}
}
}
|