From 24e1dbe8d4c5b3945a128684d63ef84049324765 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Wed, 28 Feb 2024 22:32:01 +0000 Subject: feature: Add support for markdown in the text bookmarks --- .../dashboard/bookmarks/components/TextCard.tsx | 76 ++++++++++++++-------- 1 file changed, 49 insertions(+), 27 deletions(-) (limited to 'packages/web/app/dashboard/bookmarks/components/TextCard.tsx') diff --git a/packages/web/app/dashboard/bookmarks/components/TextCard.tsx b/packages/web/app/dashboard/bookmarks/components/TextCard.tsx index 7ee1a90b..1d3fad3a 100644 --- a/packages/web/app/dashboard/bookmarks/components/TextCard.tsx +++ b/packages/web/app/dashboard/bookmarks/components/TextCard.tsx @@ -3,9 +3,13 @@ import { ZBookmark } from "@/lib/types/api/bookmarks"; import BookmarkOptions from "./BookmarkOptions"; import { api } from "@/lib/trpc"; -import { Star } from "lucide-react"; +import { Maximize2, Star } from "lucide-react"; import { cn } from "@/lib/utils"; import TagList from "./TagList"; +import Markdown from "react-markdown"; +import { useState } from "react"; +import { BookmarkedTextViewer } from "./BookmarkedTextViewer"; +import { Button } from "@/components/ui/button"; export default function TextCard({ bookmark: initialData, @@ -22,6 +26,7 @@ export default function TextCard({ initialData, }, ); + const [previewModalOpen, setPreviewModalOpen] = useState(false); const bookmarkedText = bookmark.content; if (bookmarkedText.type != "text") { throw new Error("Unexpected bookmark type"); @@ -30,33 +35,50 @@ export default function TextCard({ const numWords = bookmarkedText.text.split(" ").length; return ( -
12 ? "row-span-2 h-96" : "row-span-1 h-40", - ), - )} - > -

- {bookmarkedText.text} -

-
- -
-
-
- {bookmark.favourited && ( - - )} + <> + +
12 ? "row-span-2 h-96" : "row-span-1 h-40", + ), + )} + > + + {bookmarkedText.text} + +
+ +
+
+
+
+
+ {bookmark.favourited && ( + + )} +
+ + +
-
-
+ ); } -- cgit v1.2.3-70-g09d2