import { useEffect, useState } from 'react' /** * Hook para navbar sticky - migrado de Techwind * Agrega clase 'nav-sticky' al navbar cuando el scroll > 50px */ export function useScrollSticky() { const [isSticky, setIsSticky] = useState(false) useEffect(() => { const handleScroll = () => { const scrollTop = window.scrollY || document.documentElement.scrollTop setIsSticky(scrollTop >= 50) } window.addEventListener('scroll', handleScroll, { passive: true }) handleScroll() // Check initial state return () => window.removeEventListener('scroll', handleScroll) }, []) return isSticky }