fix: Revert "fix: allow landing page scroll" (#5697)

Revert "fix: allow landing page scroll (#5692)"

This reverts commit 642c4892407c5864cd323bd1477a7b7c8ebb31d2.
This commit is contained in:
Vignesh Mohankumar 2022-12-15 11:05:53 -05:00 committed by GitHub
parent 9ae31aa26e
commit 23ed384802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,7 @@ import { BrowserEvent, ElementName, EventName, PageName } from '@uniswap/analyti
import { BaseButton } from 'components/Button' import { BaseButton } from 'components/Button'
import { LandingPageVariant, useLandingPageFlag } from 'featureFlags/flags/landingPage' import { LandingPageVariant, useLandingPageFlag } from 'featureFlags/flags/landingPage'
import Swap from 'pages/Swap' import Swap from 'pages/Swap'
import { useEffect } from 'react'
import { useLocation } from 'react-router-dom' import { useLocation } from 'react-router-dom'
import { Link as NativeLink } from 'react-router-dom' import { Link as NativeLink } from 'react-router-dom'
import { useIsDarkMode } from 'state/user/hooks' import { useIsDarkMode } from 'state/user/hooks'
@ -171,6 +172,18 @@ export default function Landing() {
const landingPageFlag = useLandingPageFlag() const landingPageFlag = useLandingPageFlag()
useEffect(() => {
if (landingPageFlag) {
document.body.style.overflow = 'hidden'
return () => {
document.body.style.overflow = 'auto'
}
}
return () => {
// need to have a return so the hook doesn't throw.
}
}, [landingPageFlag])
if (landingPageFlag === LandingPageVariant.Control || !isOpen) return null if (landingPageFlag === LandingPageVariant.Control || !isOpen) return null
return ( return (