Navbar selected link

This commit is contained in:
2026-02-12 14:30:03 +01:00
parent f8770477b4
commit 914e5881fe
+9 -1
View File
@@ -1,3 +1,5 @@
"use client";
import Link from "next/link"; import Link from "next/link";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import { import {
@@ -8,6 +10,8 @@ import {
WalletIcon, WalletIcon,
} from "lucide-react"; } from "lucide-react";
import { SolanaLogo } from "../logos"; import { SolanaLogo } from "../logos";
import { cn } from "@/lib/utils";
import { usePathname } from "next/navigation";
const links = [ const links = [
{ {
@@ -23,6 +27,7 @@ const links = [
export default function Navbar() { export default function Navbar() {
const personalItemClass = const personalItemClass =
"rounded-full bg-card p-2! aspect-square group hover:bg-accent/20 hover:text-accent"; "rounded-full bg-card p-2! aspect-square group hover:bg-accent/20 hover:text-accent";
const pathname = usePathname();
return ( return (
<nav className="border-b border-b-border py-4 px-5 flex gap-5 items-center"> <nav className="border-b border-b-border py-4 px-5 flex gap-5 items-center">
@@ -36,7 +41,10 @@ export default function Navbar() {
<li key={l.path}> <li key={l.path}>
<Link <Link
href={l.path} href={l.path}
className="px-3 py-2 rounded-lg hover:bg-primary/20 hover:text-primary transition-colors duration-300" className={cn(
"px-3 py-2 rounded-lg hover:bg-primary/20 hover:text-primary transition-colors duration-300",
l.path === pathname && "text-primary",
)}
> >
{l.name} {l.name}
</Link> </Link>