Merge pull request 'feat: scrollTop 기능 추가' (#35) from feature/float-button into dev
Reviewed-on: #35
This commit is contained in:
commit
21c0a7a3a0
@ -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>
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user