diff --git a/src/components/shared/footer/footer.tsx b/src/components/shared/footer/footer.tsx index df06dbb7..32e6f2a2 100644 --- a/src/components/shared/footer/footer.tsx +++ b/src/components/shared/footer/footer.tsx @@ -1,5 +1,7 @@ import Image from 'next/image'; +import { useEffect, useState } from 'react'; + import { MENU } from '@/constants/menu'; import Link from '@/components/shared/link'; @@ -7,6 +9,31 @@ import Link from '@/components/shared/link'; import logo from '@/svgs/logo.svg'; function Footer() { + const [showButton, setShowButton] = useState(false); + + useEffect(() => { + const handleScroll = () => { + if (window.scrollY > 100) { + setShowButton(true); + } else { + setShowButton(false); + } + }; + + window.addEventListener('scroll', handleScroll); + + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }, []); + + const scrollToTop = () => { + window.scrollTo({ + top: 0, + behavior: 'smooth', + }); + }; + return ( ); }