import { ArrowUpIcon } from '@heroicons/react/solid' import clsx from 'clsx' import { useEffect, useState } from 'react' import { Row } from './layout/row' export function ScrollToTopButton(props: { className?: string }) { const { className } = props const [visible, setVisible] = useState(false) useEffect(() => { const onScroll = () => { if (window.scrollY > 500) { setVisible(true) } else { setVisible(false) } } window.addEventListener('scroll', onScroll, { passive: true }) return () => { window.removeEventListener('scroll', onScroll) } }, []) const scrollToTop = () => { window.scrollTo({ top: 0, behavior: 'smooth', }) } return ( ) }