From 47939a5409a0eb18b088c37b011ca6a3c4920746 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sun, 15 Sep 2024 00:50:02 +0000 Subject: feature(web): Add a compact layout. Fixes #379 --- .../bookmarks/BookmarkLayoutAdaptingCard.tsx | 57 +++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx') diff --git a/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx b/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx index f5891f40..e11e4295 100644 --- a/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx +++ b/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx @@ -1,5 +1,6 @@ import type { BookmarksLayoutTypes } from "@/lib/userLocalSettings/types"; import React, { useEffect, useState } from "react"; +import Image from "next/image"; import Link from "next/link"; import useBulkActionsStore from "@/lib/bulkActions"; import { @@ -8,11 +9,12 @@ import { } from "@/lib/userLocalSettings/bookmarksLayout"; import { cn } from "@/lib/utils"; import dayjs from "dayjs"; -import { Check } from "lucide-react"; +import { Check, Image as ImageIcon, NotebookPen } from "lucide-react"; import { useTheme } from "next-themes"; import type { ZBookmark } from "@hoarder/shared/types/bookmarks"; import { isBookmarkStillTagging } from "@hoarder/shared-react/utils/bookmarkUtils"; +import { BookmarkTypes } from "@hoarder/shared/types/bookmarks"; import BookmarkActionBar from "./BookmarkActionBar"; import TagList from "./TagList"; @@ -187,6 +189,58 @@ function GridView({ ); } +function CompactView({ bookmark, title, footer, className }: Props) { + return ( +
+ +
+
+ {bookmark.content.type === BookmarkTypes.LINK && + bookmark.content.favicon && ( + favicon + )} + {bookmark.content.type === BookmarkTypes.TEXT && ( + + )} + {bookmark.content.type === BookmarkTypes.ASSET && ( + + )} + { +
+ {title ?? "Untitled"} +
+ } + {footer && ( +

•{footer}

+ )} +

+ + {dayjs(bookmark.createdAt).format("MMM DD")} + +
+ +
+
+ ); +} + export function BookmarkLayoutAdaptingCard(props: Props) { const layout = useBookmarkLayout(); @@ -194,5 +248,6 @@ export function BookmarkLayoutAdaptingCard(props: Props) { masonry: , grid: , list: , + compact: , }); } -- cgit v1.2.3-70-g09d2