Compare commits

...

2 Commits

Author SHA1 Message Date
21c0a7a3a0 Merge pull request 'feat: scrollTop 기능 추가' (#35) from feature/float-button into dev
Reviewed-on: #35
2025-05-15 18:31:30 +09:00
Daseul Kim
bc3193714a feat: scrollTop 기능 추가 2025-05-15 18:28:31 +09:00

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>
}