From 4f17ea61cbb11a72712a1ea8c98904a1cc513e41 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 14 Apr 2024 00:51:56 +0300 Subject: feature(web): Allow changing the bookmark grid layout (#98) --- .../dashboard/sidebar/SidebarProfileOptions.tsx | 90 ++++++++++++++++++---- 1 file changed, 76 insertions(+), 14 deletions(-) (limited to 'apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx') diff --git a/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx b/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx index 3fe4d52f..c75e292a 100644 --- a/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx +++ b/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx @@ -6,33 +6,86 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, + DropdownMenuSub, + DropdownMenuSubContent, + DropdownMenuSubTrigger, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; -import { Slot } from "@radix-ui/react-slot"; -import { LogOut, Moon, MoreHorizontal, Sun } from "lucide-react"; +import { useBookmarkLayout } from "@/lib/userLocalSettings/bookmarksLayout"; +import { updateBookmarksLayout } from "@/lib/userLocalSettings/userLocalSettings"; +import { + Check, + LayoutDashboard, + LayoutGrid, + LayoutList, + LayoutPanelLeft, + LogOut, + Moon, + MoreHorizontal, + Sun, +} from "lucide-react"; import { signOut } from "next-auth/react"; import { useTheme } from "next-themes"; +function BookmarkLayoutSelector() { + const layout = useBookmarkLayout(); + + const checkedComp = ; + + return ( + <> + await updateBookmarksLayout("masonry")} + > +
+ + Masonry +
+ {layout == "masonry" && checkedComp} +
+ await updateBookmarksLayout("grid")} + > +
+ + Grid +
+ {layout == "grid" && checkedComp} +
+ await updateBookmarksLayout("list")} + > +
+ + List +
+ {layout == "list" && checkedComp} +
+ + ); +} + function DarkModeToggle() { const { theme } = useTheme(); - let comp; if (theme == "dark") { - comp = ( - - -

Light Mode

-
+ return ( + <> + + Light Mode + ); } else { - comp = ( - - -

Dark Mode

-
+ return ( + <> + + Dark Mode + ); } - return {comp}; } export default function SidebarProfileOptions() { @@ -48,6 +101,15 @@ export default function SidebarProfileOptions() { + + + + Layout + + + + + signOut({ -- cgit v1.2.3-70-g09d2