diff options
| author | MohamedBassem <me@mbassem.com> | 2024-04-07 18:30:00 +0100 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-04-07 19:00:00 +0100 |
| commit | 79d61be7e15dc5d23fb687a5f71e0097088a99ac (patch) | |
| tree | da72f19cdb74ef4ed2a75bcfddd13bdfb874f205 /apps/web/components/dashboard/preview/AssetContentSection.tsx | |
| parent | 44918316007ed3153dc802a4b11db3ea09024a8b (diff) | |
| download | karakeep-79d61be7e15dc5d23fb687a5f71e0097088a99ac.tar.zst | |
feature: Extract hook logic into separate package and add a new action bar in bookmark preview
Diffstat (limited to 'apps/web/components/dashboard/preview/AssetContentSection.tsx')
| -rw-r--r-- | apps/web/components/dashboard/preview/AssetContentSection.tsx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/apps/web/components/dashboard/preview/AssetContentSection.tsx b/apps/web/components/dashboard/preview/AssetContentSection.tsx new file mode 100644 index 00000000..3fbbc519 --- /dev/null +++ b/apps/web/components/dashboard/preview/AssetContentSection.tsx @@ -0,0 +1,31 @@ +import Image from "next/image"; + +import type { ZBookmark } from "@hoarder/trpc/types/bookmarks"; + +export function AssetContentSection({ bookmark }: { bookmark: ZBookmark }) { + if (bookmark.content.type != "asset") { + throw new Error("Invalid content type"); + } + + let content; + switch (bookmark.content.assetType) { + case "image": { + switch (bookmark.content.assetType) { + case "image": { + content = ( + <div className="relative h-full min-w-full"> + <Image + alt="asset" + fill={true} + className="object-contain" + src={`/api/assets/${bookmark.content.assetId}`} + /> + </div> + ); + } + } + break; + } + } + return content; +} |
