chore: Fixed linter warnings
This commit is contained in:
parent
56df5d5287
commit
2234155052
70 changed files with 103 additions and 309 deletions
|
@ -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 (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue