1
0
Fork 0

chore: Fixed linter warnings

This commit is contained in:
Joost De Cock 2022-01-20 09:07:38 +01:00
parent 56df5d5287
commit 2234155052
70 changed files with 103 additions and 309 deletions

View file

@ -22,21 +22,20 @@ const Header = ({ app, setSearch }) => {
const [prevScrollPos, setPrevScrollPos] = useState(0)
const [show, setShow] = useState(true)
const handleScroll = () => {
const curScrollPos = (typeof window !== 'undefined') ? window.pageYOffset : 0
if (curScrollPos >= prevScrollPos) {
if (show && curScrollPos > 20) setShow(false)
}
else setShow(true)
setPrevScrollPos(curScrollPos)
}
useEffect(() => {
if (typeof window !== 'undefined') {
const handleScroll = () => {
const curScrollPos = (typeof window !== 'undefined') ? window.pageYOffset : 0
if (curScrollPos >= prevScrollPos) {
if (show && curScrollPos > 20) setShow(false)
}
else setShow(true)
setPrevScrollPos(curScrollPos)
}
window.addEventListener('scroll', handleScroll)
return () => window.removeEventListener('scroll', handleScroll)
}
}, [prevScrollPos, show, handleScroll])
}, [prevScrollPos, show])
return (