feat: scrollTop 기능 추가

This commit is contained in:
Daseul Kim 2025-05-15 18:28:31 +09:00
parent d03c01e3a9
commit bc3193714a

View File

@ -5,9 +5,16 @@ import { usePathname } from 'next/navigation'
export default function FloatBtn() {
const pathname = usePathname()
const scrollToTop = () => {
window.scrollTo({
top: 0,
behavior: 'smooth',
})
}
if (pathname === '/login' || pathname === '/') {
return null
}
return <button className="top-btn"></button>
return <button className="top-btn" onClick={scrollToTop}></button>
}