From 47bd449fbe50a7b423db860ee6a34a7a3f7c3bb4 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sat, 23 Mar 2024 14:33:28 +0000 Subject: feature(web): Add dark mode support --- .../dashboard/bookmarks/BookmarkPreview.tsx | 11 +++++---- .../components/dashboard/bookmarks/Bookmarks.tsx | 3 ++- .../dashboard/bookmarks/BookmarksGrid.tsx | 2 +- .../components/dashboard/bookmarks/EditorCard.tsx | 5 +++-- .../components/dashboard/bookmarks/LinkCard.tsx | 2 +- .../components/dashboard/bookmarks/TagsEditor.tsx | 26 +++++++++++++++++++--- .../components/dashboard/bookmarks/TextCard.tsx | 2 +- 7 files changed, 38 insertions(+), 13 deletions(-) (limited to 'apps/web/components/dashboard/bookmarks') diff --git a/apps/web/components/dashboard/bookmarks/BookmarkPreview.tsx b/apps/web/components/dashboard/bookmarks/BookmarkPreview.tsx index 2c393fe7..96e1c19b 100644 --- a/apps/web/components/dashboard/bookmarks/BookmarkPreview.tsx +++ b/apps/web/components/dashboard/bookmarks/BookmarkPreview.tsx @@ -3,6 +3,7 @@ import Image from "next/image"; import Link from "next/link"; import { ScrollArea } from "@/components/ui/scroll-area"; +import { Separator } from "@/components/ui/separator"; import { Skeleton } from "@/components/ui/skeleton"; import { Tooltip, @@ -82,7 +83,7 @@ function LinkHeader({ bookmark }: { bookmark: ZBookmark }) { View Original -
+ ); } @@ -103,7 +104,7 @@ function TextContentSection({ bookmark }: { bookmark: ZBookmark }) { dangerouslySetInnerHTML={{ __html: bookmark.content.htmlContent || "", }} - className="prose mx-auto" + className="prose dark:prose-invert mx-auto" /> ); } @@ -111,7 +112,9 @@ function TextContentSection({ bookmark }: { bookmark: ZBookmark }) { } case "text": { content = ( - {bookmark.content.text} + + {bookmark.content.text} + ); break; } @@ -195,7 +198,7 @@ export default function BookmarkPreview({
{isBookmarkStillCrawling(bookmark) ? : content}
-
+
{linkHeader}
diff --git a/apps/web/components/dashboard/bookmarks/Bookmarks.tsx b/apps/web/components/dashboard/bookmarks/Bookmarks.tsx index cee620c9..81dd9361 100644 --- a/apps/web/components/dashboard/bookmarks/Bookmarks.tsx +++ b/apps/web/components/dashboard/bookmarks/Bookmarks.tsx @@ -1,4 +1,5 @@ import { redirect } from "next/navigation"; +import { Separator } from "@/components/ui/separator"; import { api } from "@/server/api/client"; import { getServerAuthSession } from "@/server/auth"; @@ -27,7 +28,7 @@ export default async function Bookmarks({ return (
{header} - {showDivider &&
} + {showDivider && } + {children} ); diff --git a/apps/web/components/dashboard/bookmarks/EditorCard.tsx b/apps/web/components/dashboard/bookmarks/EditorCard.tsx index dfcf1f6c..d8a3c117 100644 --- a/apps/web/components/dashboard/bookmarks/EditorCard.tsx +++ b/apps/web/components/dashboard/bookmarks/EditorCard.tsx @@ -1,6 +1,7 @@ import type { SubmitErrorHandler, SubmitHandler } from "react-hook-form"; import { ActionButton } from "@/components/ui/action-button"; import { Form, FormControl, FormField, FormItem } from "@/components/ui/form"; +import { Separator } from "@/components/ui/separator"; import { Textarea } from "@/components/ui/textarea"; import { toast } from "@/components/ui/use-toast"; import { api } from "@/lib/trpc"; @@ -55,12 +56,12 @@ export default function EditorCard({ className }: { className?: string }) {

NEW ITEM

-
+
diff --git a/apps/web/components/dashboard/bookmarks/TagsEditor.tsx b/apps/web/components/dashboard/bookmarks/TagsEditor.tsx index bebd53df..e11410b8 100644 --- a/apps/web/components/dashboard/bookmarks/TagsEditor.tsx +++ b/apps/web/components/dashboard/bookmarks/TagsEditor.tsx @@ -99,6 +99,17 @@ export function TagsEditor({ bookmark }: { bookmark: ZBookmark }) { closeMenuOnSelect={false} isClearable={false} isLoading={isExistingTagsLoading || isMutating} + theme={(theme) => ({ + ...theme, + // This color scheme doesn't support disabled options. + colors: { + ...theme.colors, + primary: "hsl(var(--accent))", + primary50: "hsl(var(--accent))", + primary75: "hsl(var(--accent))", + primary25: "hsl(var(--accent))", + }, + })} styles={{ multiValueRemove: () => ({ "background-color": "transparent", @@ -110,6 +121,14 @@ export function TagsEditor({ bookmark }: { bookmark: ZBookmark }) { overflowY: "auto", scrollbarWidth: "none", }), + control: (styles) => ({ + ...styles, + "background-color": "hsl(var(--background))", + "border-color": "hsl(var(--border))", + ":hover": { + "border-color": "hsl(var(--border))", + }, + }), }} components={{ MultiValueContainer: ({ children, data }) => ( @@ -118,7 +137,7 @@ export function TagsEditor({ bookmark }: { bookmark: ZBookmark }) { "flex min-h-8 space-x-1 rounded px-2", (data as { attachedBy: string }).attachedBy == "ai" ? "bg-gradient-to-tr from-purple-500 to-purple-400 text-white" - : "bg-gray-200", + : "bg-accent", )} > {children} @@ -137,8 +156,9 @@ export function TagsEditor({ bookmark }: { bookmark: ZBookmark }) { }} classNames={{ multiValueRemove: () => "my-auto", - valueContainer: () => "gap-2", - menuList: () => "text-sm", + valueContainer: () => "gap-2 bg-background", + menuList: () => "text-sm bg-background", + option: () => "text-red-500", }} /> ); diff --git a/apps/web/components/dashboard/bookmarks/TextCard.tsx b/apps/web/components/dashboard/bookmarks/TextCard.tsx index 75733063..82664390 100644 --- a/apps/web/components/dashboard/bookmarks/TextCard.tsx +++ b/apps/web/components/dashboard/bookmarks/TextCard.tsx @@ -58,7 +58,7 @@ export default function TextCard({ ), )} > - + {bookmarkedText.text}
-- cgit v1.2.3-70-g09d2