import { useState, useEffect } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { FiSun, FiMoon, FiX, FiTerminal } from 'react-icons/fi' import { useScrollSpy } from '../hooks/useScrollSpy' import resumePDF from '../assets/Resume.pdf' const NAV_LINKS = [ { id: 'about', label: 'About' }, { id: 'skills', label: 'Skills' }, { id: 'experience', label: 'Experience' }, { id: 'publications', label: 'Publications' }, { id: 'projects', label: 'Projects' }, { id: 'education', label: 'Education' }, { id: 'blog', label: 'Blog' }, { id: 'contact', label: 'Contact' }, ] export default function Navbar({ theme, setTheme }) { const [scrolled, setScrolled] = useState(false) const [mobileOpen, setMobileOpen] = useState(false) const activeId = useScrollSpy(NAV_LINKS.map(l => l.id)) useEffect(() => { const fn = () => setScrolled(window.scrollY > 40) window.addEventListener('scroll', fn, { passive: true }) return () => window.removeEventListener('scroll', fn) }, []) const scrollTo = (id) => { document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' }) setMobileOpen(false) } return ( <> window.scrollTo({ top: 0, behavior: 'smooth' })} whileHover={{ scale: 1.04 }}> Parthib Karak. {NAV_LINKS.map(link => ( { e.preventDefault(); scrollTo(link.id) }}> {link.label} ))} setTheme(theme === 'dark' ? 'light' : 'dark')} aria-label="Toggle theme"> {theme === 'dark' ? : } Resume ↓ setMobileOpen(true)} aria-label="Open menu"> {mobileOpen && ( setMobileOpen(false)} aria-label="Close menu" style={{ position: 'absolute', top: 22, right: 22, background: 'none', border: 'none', cursor: 'pointer', color: 'var(--text-primary)', fontSize: '1.3rem' }}> {NAV_LINKS.map((link, i) => ( { e.preventDefault(); scrollTo(link.id) }}> {link.label} ))} )} > ) }