Fix the body scroll when the sidebar is open

This commit is contained in:
Hugo Lopes 2021-01-28 14:57:32 +00:00
parent 5d8f3375e8
commit 381936dc99
2 changed files with 5 additions and 4 deletions

View File

@ -61,16 +61,16 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
<main className="fit">{children}</main> <main className="fit">{children}</main>
<Footer pages={pageProps.pages} /> <Footer pages={pageProps.pages} />
<Sidebar open={displaySidebar} onClose={closeSidebar}>
<CartSidebarView />
</Sidebar>
<Modal open={displayModal} onClose={closeModal}> <Modal open={displayModal} onClose={closeModal}>
{modalView === 'LOGIN_VIEW' && <LoginView />} {modalView === 'LOGIN_VIEW' && <LoginView />}
{modalView === 'SIGNUP_VIEW' && <SignUpView />} {modalView === 'SIGNUP_VIEW' && <SignUpView />}
{modalView === 'FORGOT_VIEW' && <ForgotPassword />} {modalView === 'FORGOT_VIEW' && <ForgotPassword />}
</Modal> </Modal>
<Sidebar open={displaySidebar} onClose={closeSidebar}>
<CartSidebarView />
</Sidebar>
<FeatureBar <FeatureBar
title="This site uses cookies to improve your experience. By clicking, you agree to our Privacy Policy." title="This site uses cookies to improve your experience. By clicking, you agree to our Privacy Policy."
hide={acceptedCookies} hide={acceptedCookies}

View File

@ -90,6 +90,7 @@ function uiReducer(state: State, action: Action) {
return { return {
...state, ...state,
displayModal: true, displayModal: true,
displaySidebar: false,
} }
} }
case 'CLOSE_MODAL': { case 'CLOSE_MODAL': {