diff options
| author | Mohamed Bassem <me@mbassem.com> | 2024-04-19 00:09:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-19 00:09:27 +0100 |
| commit | e0999f701cd1834c3d940113cd8dd5247c5fe95f (patch) | |
| tree | c4169a564ecd3f933e711bcc8ef7db20532174ea /apps/web/components/dashboard/sidebar/SidebarItem.tsx | |
| parent | deba31ee010f785a9739fd4df8a64a3056c9593d (diff) | |
| download | karakeep-e0999f701cd1834c3d940113cd8dd5247c5fe95f.tar.zst | |
feature: Nested lists (#110). Fixes #62
* feature: Add support for nested lists
* prevent moving the parent to a subtree
Diffstat (limited to 'apps/web/components/dashboard/sidebar/SidebarItem.tsx')
| -rw-r--r-- | apps/web/components/dashboard/sidebar/SidebarItem.tsx | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/apps/web/components/dashboard/sidebar/SidebarItem.tsx b/apps/web/components/dashboard/sidebar/SidebarItem.tsx index 7e5eb3bd..262fd9ae 100644 --- a/apps/web/components/dashboard/sidebar/SidebarItem.tsx +++ b/apps/web/components/dashboard/sidebar/SidebarItem.tsx @@ -1,5 +1,6 @@ "use client"; +import React from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { cn } from "@/lib/utils"; @@ -9,25 +10,36 @@ export default function SidebarItem({ logo, path, className, + style, + collapseButton, + right = null, }: { name: string; logo: React.ReactNode; path: string; + style?: React.CSSProperties; className?: string; + right?: React.ReactNode; + collapseButton?: React.ReactNode; }) { const currentPath = usePathname(); return ( <li className={cn( - "rounded-lg px-3 py-2 hover:bg-accent", + "relative rounded-lg px-3 py-2 hover:bg-accent", path == currentPath ? "bg-accent/50" : "", className, )} + style={style} > - <Link href={path} className="flex w-full gap-x-2"> - {logo} - <span className="my-auto"> {name} </span> - </Link> + {collapseButton} + <div className="flex justify-between"> + <Link href={path} className="flex w-full gap-x-2"> + {logo} + <span className="my-auto"> {name} </span> + </Link> + {right} + </div> </li> ); } |
