Spaces:
Running
Running
| "use client"; | |
| import React, { useState, useEffect } from "react"; | |
| import Link from "next/link"; | |
| import { Github } from "lucide-react"; | |
| import { Button } from "@/components/ui/button"; | |
| import { PortfolioLogo } from "@/components/icons"; | |
| import { cn } from "@/lib/utils"; | |
| const navItems = [ | |
| { name: "About", href: "#about" }, | |
| { name: "Projects", href: "#projects" }, | |
| { name: "Skills", href: "#skills" }, | |
| { name: "Contact", href: "#contact" }, | |
| ]; | |
| export function Header() { | |
| const [isScrolled, setIsScrolled] = useState(false); | |
| useEffect(() => { | |
| const handleScroll = () => { | |
| setIsScrolled(window.scrollY > 10); | |
| }; | |
| window.addEventListener("scroll", handleScroll); | |
| return () => { | |
| window.removeEventListener("scroll", handleScroll); | |
| }; | |
| }, []); | |
| return ( | |
| <header | |
| className={cn( | |
| "sticky top-0 z-50 w-full transition-all duration-300", | |
| isScrolled | |
| ? "bg-background/80 backdrop-blur-sm border-b" | |
| : "bg-background" | |
| )} | |
| > | |
| <div className="container flex h-16 items-center"> | |
| <Link href="/" className="mr-6 flex items-center space-x-2"> | |
| <PortfolioLogo className="h-6 w-6 text-primary" /> | |
| <span className="font-bold font-headline inline-block"> | |
| Portfolio | |
| </span> | |
| </Link> | |
| <nav className="hidden md:flex items-center space-x-6 text-sm font-medium"> | |
| {navItems.map((item) => ( | |
| <Link | |
| key={item.name} | |
| href={item.href} | |
| className="transition-colors hover:text-primary" | |
| > | |
| {item.name} | |
| </Link> | |
| ))} | |
| </nav> | |
| <div className="flex flex-1 items-center justify-end space-x-4"> | |
| <a | |
| href="https://github.com/sameerbanchhor-git" | |
| target="_blank" | |
| rel="noopener noreferrer" | |
| > | |
| <Button variant="ghost" size="icon" aria-label="GitHub"> | |
| <Github className="h-5 w-5" /> | |
| </Button> | |
| </a> | |
| </div> | |
| </div> | |
| </header> | |
| ); | |
| } | |