'use client' import { useEffect, useRef, useState } from 'react' import Link from 'next/link' import { AnimatePresence, motion } from 'framer-motion' import clsx from 'clsx' function NavLinks() { let [hoveredIndex, setHoveredIndex] = useState(null) let timeoutRef = useRef(null) return (
{[ ['Technologies', '/#technologies'], ['Network', '/#network'], ['How it Works', '/#how-it-works'], ['Get Started', '/#get-started'], ['Contact', '/#contact'], ].map(([label, href], index) => ( { if (timeoutRef.current) { window.clearTimeout(timeoutRef.current) } setHoveredIndex(index) }} onMouseLeave={() => { timeoutRef.current = window.setTimeout(() => { setHoveredIndex(null) }, 200) }} > {hoveredIndex === index && ( )} {label} ))}
) } export function HeaderLight() { const [isVisible, setIsVisible] = useState(true); const [lastScrollY, setLastScrollY] = useState(0); const controlHeader = () => { if (typeof window !== 'undefined') { if (window.scrollY > lastScrollY && window.scrollY > 100) { // Hides when scrolling down past 100px setIsVisible(false); } else { // Shows when scrolling up setIsVisible(true); } setLastScrollY(window.scrollY); } }; useEffect(() => { if (typeof window !== 'undefined') { window.addEventListener('scroll', controlHeader); return () => { window.removeEventListener('scroll', controlHeader); }; } }, [lastScrollY]); return (
) }