Skip to content

Commit

Permalink
feat: install clsx and active navbar link now shows lighter background
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcasstlesjones committed Nov 27, 2024
1 parent cf8eabf commit 5ba43f9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"@heroicons/react": "^2.2.0",
"@serwist/next": "^9.0.10",
"clsx": "^2.1.1",
"next": "15.0.3",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106",
Expand Down
2 changes: 2 additions & 0 deletions src/ui/layout/Navbar/NavbarLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import {
HomeIcon,
PresentationChartLineIcon,
Expand Down
14 changes: 13 additions & 1 deletion src/ui/layout/Navbar/NavigationLink.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";
import clsx from "clsx";

interface NavbarButtonProps {
title: string;
Expand All @@ -11,8 +15,16 @@ export default function NavigationLink({
Icon,
destination,
}: NavbarButtonProps) {
const pathname = usePathname();
const isActive = pathname === destination;

return (
<Link href={destination} className={`flex flex-col items-center`}>
<Link
href={destination}
className={clsx(`flex flex-col items-center rounded-3xl p-1 py-3`, {
"bg-purple-900": isActive,
})}
>
<p className="text-white">{title}</p>
<Icon className="h-6 w-6 text-white" />
</Link>
Expand Down

0 comments on commit 5ba43f9

Please sign in to comment.