21 lines
379 B
TypeScript
21 lines
379 B
TypeScript
'use client'
|
|
|
|
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" onClick={scrollToTop}></button>
|
|
}
|