mirror of
https://github.com/vercel/commerce.git
synced 2025-07-30 13:41:22 +00:00
Feature/hamburger menu (#540)
* Setup Mobile Menu Sidebar * Setup Basic Mobile Menu Items Styling * Implement full width styling for mobile devices * Cleanup Co-authored-by: Nine <at059214@Abdurahmans-MacBook-Pro.local>
This commit is contained in:
@@ -13,6 +13,7 @@ import { useAcceptCookies } from '@lib/hooks/useAcceptCookies'
|
||||
import { Sidebar, Button, LoadingDots } from '@components/ui'
|
||||
import PaymentMethodView from '@components/checkout/PaymentMethodView'
|
||||
import CheckoutSidebarView from '@components/checkout/CheckoutSidebarView'
|
||||
import MenuSidebarView, { Link } from '../UserNav/MenuSidebarView'
|
||||
|
||||
import LoginView from '@components/auth/LoginView'
|
||||
import s from './Layout.module.css'
|
||||
@@ -74,12 +75,14 @@ const ModalUI: FC = () => {
|
||||
) : null
|
||||
}
|
||||
|
||||
const SidebarView: FC<{ sidebarView: string; closeSidebar(): any }> = ({
|
||||
sidebarView,
|
||||
closeSidebar,
|
||||
}) => {
|
||||
const SidebarView: FC<{
|
||||
sidebarView: string
|
||||
closeSidebar(): any
|
||||
links: Link[]
|
||||
}> = ({ sidebarView, closeSidebar, links }) => {
|
||||
return (
|
||||
<Sidebar onClose={closeSidebar}>
|
||||
{sidebarView === 'MOBILEMENU_VIEW' && <MenuSidebarView links={links} />}
|
||||
{sidebarView === 'CART_VIEW' && <CartSidebarView />}
|
||||
{sidebarView === 'CHECKOUT_VIEW' && <CheckoutSidebarView />}
|
||||
{sidebarView === 'PAYMENT_VIEW' && <PaymentMethodView />}
|
||||
@@ -88,10 +91,14 @@ const SidebarView: FC<{ sidebarView: string; closeSidebar(): any }> = ({
|
||||
)
|
||||
}
|
||||
|
||||
const SidebarUI: FC = () => {
|
||||
const SidebarUI: FC<{ links: any }> = ({ links }) => {
|
||||
const { displaySidebar, closeSidebar, sidebarView } = useUI()
|
||||
return displaySidebar ? (
|
||||
<SidebarView sidebarView={sidebarView} closeSidebar={closeSidebar} />
|
||||
<SidebarView
|
||||
sidebarView={sidebarView}
|
||||
closeSidebar={closeSidebar}
|
||||
links={links}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
|
||||
@@ -113,7 +120,7 @@ const Layout: FC<Props> = ({
|
||||
<main className="fit">{children}</main>
|
||||
<Footer pages={pageProps.pages} />
|
||||
<ModalUI />
|
||||
<SidebarUI />
|
||||
<SidebarUI links={navBarlinks} />
|
||||
<FeatureBar
|
||||
title="This site uses cookies to improve your experience. By clicking, you agree to our Privacy Policy."
|
||||
hide={acceptedCookies}
|
||||
|
Reference in New Issue
Block a user