mirror of
https://github.com/vercel/commerce.git
synced 2025-03-14 22:42:33 +00:00
Update code to follow dry principle
This commit is contained in:
parent
19621632f5
commit
5c4c0cebde
@ -40,8 +40,9 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
|
||||
debounce(() => {
|
||||
const offset = 0
|
||||
const { scrollTop } = document.documentElement
|
||||
if (scrollTop > offset) setHasScrolled(true)
|
||||
else setHasScrolled(false)
|
||||
const scrolled = scrollTop > offset
|
||||
|
||||
setHasScrolled(scrolled)
|
||||
}, 1)
|
||||
}, [])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user