auto-claude: subtask-3-1 - Apply throttle to Header scroll event listener
This commit is contained in:
@@ -18,6 +18,7 @@ import { usePathname } from 'next/navigation';
|
||||
import { NavLink } from './NavLink';
|
||||
import LanguageSwitcher from './LanguageSwitcher';
|
||||
import { ContactInfo } from './ContactInfo';
|
||||
import { throttle } from '@/utils/throttle';
|
||||
|
||||
const Header = () => {
|
||||
const t = useTranslations('navigation');
|
||||
@@ -33,9 +34,9 @@ const Header = () => {
|
||||
|
||||
// Scroll handler
|
||||
useEffect(() => {
|
||||
const handleScroll = () => {
|
||||
const handleScroll = throttle(() => {
|
||||
setScrolled(window.scrollY > 0);
|
||||
};
|
||||
}, 100);
|
||||
window.addEventListener('scroll', handleScroll);
|
||||
return () => window.removeEventListener('scroll', handleScroll);
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user