Merge pull request 'feat: scrollTop 기능 추가' (#35) from feature/float-button into dev

Reviewed-on: #35
This commit is contained in:
swyoo 2025-05-15 18:31:30 +09:00
commit 21c0a7a3a0

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