From 97d18d7ac3bc6ab4f40618e74f021ee63a4cf7b6 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Thu, 15 Feb 2024 16:03:24 +0000 Subject: ui: Usage images for link cards --- .../dashboard/bookmarks/components/LinkCard.tsx | 68 ++++++++++++++-------- 1 file changed, 43 insertions(+), 25 deletions(-) (limited to 'packages/web/app/dashboard/bookmarks/components/LinkCard.tsx') diff --git a/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx b/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx index 00e4ef26..7413c2fe 100644 --- a/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx +++ b/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx @@ -1,7 +1,9 @@ import { Badge } from "@/components/ui/badge"; import { ImageCard, + ImageCardBanner, ImageCardBody, + ImageCardContent, ImageCardFooter, ImageCardTitle, } from "@/components/ui/imageCard"; @@ -13,40 +15,56 @@ export default function LinkCard({ bookmark }: { bookmark: ZBookmark }) { const link = bookmark.content; const parsedUrl = new URL(link.url); + // A dummy white pixel for when there's no image. + // TODO: Better handling for cards with no images + const image = + link.imageUrl ?? + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII="; + return ( - - - {link?.title ?? parsedUrl.host} - - - - {bookmark.tags.map((t) => ( - - - #{t.name} - + + + + + + + {link?.title ?? parsedUrl.host} - ))} - - -
-
- - {parsedUrl.host} + + {/* There's a hack here. Every tag has the full hight of the container itself. That why, when we enable flex-wrap, + the overflowed don't show up. */} + + {bookmark.tags.map((t) => ( + + + #{t.name} + + ))} + + +
+
+ + {parsedUrl.host} + +
+
- -
- + + ); } -- cgit v1.2.3-70-g09d2