diff --git a/app/ui/dashboard/nav-links.tsx b/app/ui/dashboard/nav-links.tsx index 8a8212b..90b325b 100644 --- a/app/ui/dashboard/nav-links.tsx +++ b/app/ui/dashboard/nav-links.tsx @@ -1,3 +1,4 @@ +'use client' import { UserGroupIcon, HomeIcon, @@ -5,6 +6,8 @@ import { } from '@heroicons/react/24/outline'; import Link from 'next/link'; +import { usePathname } from 'next/navigation'; +import clsx from 'clsx'; // Map of links to display in the side navigation. // Depending on the size of the application, this would be stored in a database. @@ -19,6 +22,7 @@ const links = [ ]; export default function NavLinks() { + const pathname = usePathname(); return ( <> {links.map((link) => { @@ -27,8 +31,12 @@ export default function NavLinks() { + className={clsx( + 'flex h-[48px] grow items-center justify-center gap-2 rounded-md bg-gray-50 p-3 text-sm font-medium hover:bg-sky-100 hover:text-blue-600 md:flex-none md:justify-start md:p-2 md:px-3', + { + 'bg-sky-100 text-blue-600': pathname === link.href, + }, + )} >

{link.name}