mirror of
https://github.com/vercel/commerce.git
synced 2025-06-29 18:01:21 +00:00
Reorder
This commit is contained in:
parent
e1d90b3ee0
commit
d6bbd13b19
@ -2,3 +2,7 @@
|
|||||||
@apply h-full bg-primary mx-auto transition-colors duration-150;
|
@apply h-full bg-primary mx-auto transition-colors duration-150;
|
||||||
max-width: 2460px;
|
max-width: 2460px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
@apply sticky top-0 bg-primary z-40 transition-all duration-150;
|
||||||
|
}
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
import { FC, useCallback, useEffect, useState } from 'react'
|
|
||||||
import cn from 'classnames'
|
import cn from 'classnames'
|
||||||
|
import s from './Layout.module.css'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import type { Page } from '@bigcommerce/storefront-data-hooks/api/operations/get-all-pages'
|
import { usePreventScroll } from '@react-aria/overlays'
|
||||||
import { CommerceProvider } from '@bigcommerce/storefront-data-hooks'
|
import { FC, useCallback, useEffect, useState } from 'react'
|
||||||
|
import { useUI } from '@components/ui/context'
|
||||||
import { CartSidebarView } from '@components/cart'
|
import { CartSidebarView } from '@components/cart'
|
||||||
import { Container, Sidebar, Button, Modal, Toast } from '@components/ui'
|
|
||||||
import { Navbar, Featurebar, Footer } from '@components/common'
|
import { Navbar, Featurebar, Footer } from '@components/common'
|
||||||
import { LoginView, SignUpView, ForgotPassword } from '@components/auth'
|
import { LoginView, SignUpView, ForgotPassword } from '@components/auth'
|
||||||
import { useUI } from '@components/ui/context'
|
import { Container, Sidebar, Button, Modal, Toast } from '@components/ui'
|
||||||
import { usePreventScroll } from '@react-aria/overlays'
|
|
||||||
import s from './Layout.module.css'
|
|
||||||
import debounce from 'lodash.debounce'
|
import debounce from 'lodash.debounce'
|
||||||
|
|
||||||
|
import { CommerceProvider } from '@bigcommerce/storefront-data-hooks'
|
||||||
|
import type { Page } from '@bigcommerce/storefront-data-hooks/api/operations/get-all-pages'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
pageProps: {
|
pageProps: {
|
||||||
pages?: Page[]
|
pages?: Page[]
|
||||||
@ -24,9 +26,6 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
|
|||||||
closeSidebar,
|
closeSidebar,
|
||||||
closeModal,
|
closeModal,
|
||||||
modalView,
|
modalView,
|
||||||
toastText,
|
|
||||||
closeToast,
|
|
||||||
displayToast,
|
|
||||||
} = useUI()
|
} = useUI()
|
||||||
const [acceptedCookies, setAcceptedCookies] = useState(false)
|
const [acceptedCookies, setAcceptedCookies] = useState(false)
|
||||||
const [hasScrolled, setHasScrolled] = useState(false)
|
const [hasScrolled, setHasScrolled] = useState(false)
|
||||||
@ -55,18 +54,15 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
|
|||||||
return (
|
return (
|
||||||
<CommerceProvider locale={locale}>
|
<CommerceProvider locale={locale}>
|
||||||
<div className={cn(s.root)}>
|
<div className={cn(s.root)}>
|
||||||
<header
|
<header className={cn(s.header, { 'shadow-magical': hasScrolled })}>
|
||||||
className={cn(
|
|
||||||
'sticky top-0 bg-primary z-40 transition-all duration-150',
|
|
||||||
{ 'shadow-magical': hasScrolled }
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<Container>
|
<Container>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
</Container>
|
</Container>
|
||||||
</header>
|
</header>
|
||||||
<main className="fit">{children}</main>
|
<main className="fit">{children}</main>
|
||||||
<Footer pages={pageProps.pages} />
|
<Footer pages={pageProps.pages} />
|
||||||
|
|
||||||
|
{/** Aditional UI Components */}
|
||||||
<Sidebar open={displaySidebar} onClose={closeSidebar}>
|
<Sidebar open={displaySidebar} onClose={closeSidebar}>
|
||||||
<CartSidebarView />
|
<CartSidebarView />
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
@ -76,6 +72,7 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
|
|||||||
{modalView === 'SIGNUP_VIEW' && <SignUpView />}
|
{modalView === 'SIGNUP_VIEW' && <SignUpView />}
|
||||||
{modalView === 'FORGOT_VIEW' && <ForgotPassword />}
|
{modalView === 'FORGOT_VIEW' && <ForgotPassword />}
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<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}
|
||||||
@ -85,9 +82,6 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
|
|||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
{/* <Toast open={displayToast} onClose={closeModal}>
|
|
||||||
{toastText}
|
|
||||||
</Toast> */}
|
|
||||||
</div>
|
</div>
|
||||||
</CommerceProvider>
|
</CommerceProvider>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user