Files
gabrielkaszewski-next/components/navbar.tsx
Gabriel Kaszewski a087888759
All checks were successful
Build and Deploy Gabriel Kaszewski Portfolio / build-and-deploy-local (push) Successful in 1m49s
feat: add K-Suite page with interactive application organism and new app images.
2025-12-30 04:13:26 +01:00

79 lines
2.0 KiB
TypeScript

"use client";
import { useState, useEffect } from "react";
import Link from "next/link";
import { usePathname } from "next/navigation";
const Navbar = () => {
const [isScrolled, setIsScrolled] = useState(false);
const pathname = usePathname();
useEffect(() => {
const handleScroll = () => {
setIsScrolled(window.scrollY > 10);
};
window.addEventListener("scroll", handleScroll);
return () => {
window.removeEventListener("scroll", handleScroll);
};
}, []);
const navLinks = [
{ href: "/", label: "Home" },
{ href: "/k-suite", label: "K-Suite" },
{ href: "/projects", label: "Projects" },
{
href: "https://blog.gabrielkaszewski.dev/",
label: "Blog",
external: true,
},
{ href: "/about", label: "About" },
];
const baseClasses =
"fixed z-20 flex w-full items-center justify-center p-4 transition-all duration-300";
const scrolledClasses = "bg-gray-900/80 backdrop-blur-md";
const transparentClasses = "bg-transparent";
return (
<nav
className={`${baseClasses} ${isScrolled ? scrolledClasses : transparentClasses
}`}
>
<div className="flex flex-1"></div>
<div className="flex gap-4">
{navLinks.map((link) => {
const isActive = pathname === link.href;
const linkClasses = `text-lg hover:text-yellow-400 transition-colors ${isActive ? "text-yellow-400 font-semibold" : "text-white"
}`;
if (link.external) {
return (
<a
key={link.href}
href={link.href}
className={linkClasses}
target="_blank"
rel="noopener noreferrer"
>
{link.label}
</a>
);
}
return (
<Link key={link.href} href={link.href} className={linkClasses}>
{link.label}
</Link>
);
})}
</div>
</nav>
);
};
export default Navbar;