diff --git a/components/common/Layout/Layout.tsx b/components/common/Layout/Layout.tsx index 75d995c23..ff6d72aaf 100644 --- a/components/common/Layout/Layout.tsx +++ b/components/common/Layout/Layout.tsx @@ -49,21 +49,53 @@ interface Props { } } +const ModalView: FC<{ modalView: string; closeModal(): any }> = ({ + modalView, + closeModal, +}) => { + return ( + + {modalView === 'LOGIN_VIEW' && } + {modalView === 'SIGNUP_VIEW' && } + {modalView === 'FORGOT_VIEW' && } + + ) +} + +const ModalUI: FC = () => { + const { displayModal, closeModal, modalView } = useUI() + return displayModal ? ( + + ) : null +} + +const SidebarView: FC<{ sidebarView: string; closeSidebar(): any }> = ({ + sidebarView, + closeSidebar, +}) => { + return ( + + {sidebarView === 'CART_VIEW' && } + {sidebarView === 'CHECKOUT_VIEW' && } + {sidebarView === 'PAYMENT_VIEW' && } + {sidebarView === 'SHIPPING_VIEW' && } + + ) +} + +const SidebarUI: FC = () => { + const { displaySidebar, closeSidebar, sidebarView } = useUI() + return displaySidebar ? ( + + ) : null +} + const Layout: FC = ({ children, pageProps: { categories = [], ...pageProps }, }) => { - const { - displaySidebar, - displayModal, - closeSidebar, - closeModal, - modalView, - sidebarView, - } = useUI() const { acceptedCookies, onAcceptCookies } = useAcceptCookies() const { locale = 'en-US' } = useRouter() - const navBarlinks = categories.slice(0, 2).map((c) => ({ label: c.name, href: `/search/${c.slug}`, @@ -75,24 +107,8 @@ const Layout: FC = ({
{children}