aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard/sidebar/SidebarItem.tsx
blob: 75a1f6bac4e092cc85ffd83a730f7d307e14da63 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";
import { cn } from "@/lib/utils";

export default function SidebarItem({
  name,
  logo,
  path,
  className,
}: {
  name: string;
  logo: React.ReactNode;
  path: string;
  className?: string;
}) {
  const currentPath = usePathname();
  return (
    <li
      className={cn(
        "rounded-lg px-3 py-2 hover:bg-slate-100",
        path == currentPath ? "bg-gray-50" : "",
        className,
      )}
    >
      <Link href={path} className="flex w-full gap-x-2">
        {logo}
        <span className="my-auto"> {name} </span>
      </Link>
    </li>
  );
}