Removing useDialog, cause rerender

This commit is contained in:
Belen Curcio
2020-11-07 19:15:54 -03:00
parent 0b74fbad1b
commit 115cf12529
7 changed files with 112 additions and 92 deletions

View File

@@ -10,6 +10,7 @@ import { useAcceptCookies } from '@lib/hooks/useAcceptCookies'
import { CommerceProvider } from '@bigcommerce/storefront-data-hooks'
import { Sidebar, Button, Modal, LoadingDots } from '@components/ui'
import type { Page } from '@bigcommerce/storefront-data-hooks/api/operations/get-all-pages'
import { CartSidebarView } from '@components/cart'
const Loading = () => (
<div className="w-80 h-80 flex items-center text-center justify-center p-3">
@@ -20,9 +21,7 @@ const Loading = () => (
const dynamicProps = {
loading: () => <Loading />,
}
const CartSidebarView = dynamic(
() => import('@components/cart/CartSidebarView')
)
const LoginView = dynamic(
() => import('@components/auth/LoginView'),
dynamicProps
@@ -67,14 +66,17 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
<Navbar />
<main className="fit">{children}</main>
<Footer pages={pageProps.pages} />
<Sidebar open={displaySidebar} onClose={closeSidebar}>
<CartSidebarView />
</Sidebar>
<Modal open={displayModal} onClose={closeModal}>
{modalView === 'LOGIN_VIEW' && <LoginView />}
{modalView === 'SIGNUP_VIEW' && <SignUpView />}
{modalView === 'FORGOT_VIEW' && <ForgotPassword />}
</Modal>
<FeatureBar
title="This site uses cookies to improve your experience. By clicking, you agree to our Privacy Policy."
hide={acceptedCookies}