| @@ -0,0 +1,24 @@ | |||
| import { Box } from '@mui/system'; | |||
| const CardContainer = ({ children }) => { | |||
| return ( | |||
| <Box | |||
| sx={{ | |||
| ml: { md: 2 }, | |||
| mt: { xs: 5, md: 0 }, | |||
| display: 'flex', | |||
| flexDirection: { | |||
| xs: 'column', | |||
| sm: 'row', | |||
| lg: 'column', | |||
| }, | |||
| justifyContent: { sm: 'space-between' }, | |||
| flexWrap: 'wrap', | |||
| }} | |||
| > | |||
| {children} | |||
| </Box> | |||
| ); | |||
| }; | |||
| export default CardContainer; | |||
| @@ -9,9 +9,9 @@ const DataCard = ({ data, quantity }) => { | |||
| sx={{ | |||
| backgroundColor: '#f2f2f2', | |||
| mb: 2, | |||
| py: 2, | |||
| p: 2, | |||
| mx: { xs: 0, sm: 1 }, | |||
| width: { xs: '100%', sm: '44%', md: '30%', lg: '100%' }, | |||
| width: { xs: '100%', sm: '44%', md: '100%', lg: '100%' }, | |||
| }} | |||
| > | |||
| <Box | |||
| @@ -5,11 +5,13 @@ import PropType from 'prop-types'; | |||
| const OrderCard = ({ data }) => { | |||
| return ( | |||
| <Card | |||
| height="100%" | |||
| sx={{ | |||
| width: '100%', | |||
| backgroundColor: '#f2f2f2', | |||
| p: 2, | |||
| mb: 2, | |||
| p: 2, | |||
| mx: { xs: 0, sm: 1 }, | |||
| width: { xs: '100%', sm: '47%', md: '100%', lg: '100%' }, | |||
| }} | |||
| > | |||
| <Box | |||
| @@ -1,4 +1,4 @@ | |||
| import { Button, Divider, Paper, Typography } from '@mui/material'; | |||
| import { Button, Card, Divider, Typography } from '@mui/material'; | |||
| import { Box } from '@mui/system'; | |||
| import Image from 'next/image'; | |||
| import { useRouter } from 'next/router'; | |||
| @@ -8,10 +8,7 @@ import PropType from 'prop-types'; | |||
| const OrderSummaryCard = ({ data }) => { | |||
| const router = useRouter(); | |||
| return ( | |||
| <Paper | |||
| sx={{ p: 3, width: '100%', mb: 2, backgroundColor: '#f1f1f1' }} | |||
| elevation={3} | |||
| > | |||
| <Card sx={{ p: 3, width: '100%', mb: 2, backgroundColor: '#f1f1f1' }}> | |||
| <Typography | |||
| sx={{ | |||
| fontSize: 26, | |||
| @@ -69,7 +66,7 @@ const OrderSummaryCard = ({ data }) => { | |||
| Once the checkout process begins you will have an hour to complete your | |||
| checkout otherwise you will be returned back to the cart to start over. | |||
| </Typography> | |||
| </Paper> | |||
| </Card> | |||
| ); | |||
| }; | |||
| @@ -1,10 +1,12 @@ | |||
| import { Typography } from '@mui/material'; | |||
| import { Box } from '@mui/system'; | |||
| import { destroyCookie } from 'nookies'; | |||
| import { useEffect, useState } from 'react'; | |||
| import { useStore, useStoreUpdate } from '../../store/cart-context'; | |||
| import CartCard from '../cards/cart-card/CartCard'; | |||
| import OrderSummaryCard from '../cards/order-summary-card/OrderSummaryCard'; | |||
| import EmptyCart from '../empty-cart/EmptyCart'; | |||
| import ContentContainer from '../layout/content-wrapper/ContentContainer'; | |||
| import PageWrapper from '../layout/page-wrapper/PageWrapper'; | |||
| import StepTitle from '../layout/steps-title/StepTitle'; | |||
| const CartContent = () => { | |||
| @@ -42,34 +44,14 @@ const CartContent = () => { | |||
| ></CartCard> | |||
| )); | |||
| } else { | |||
| return ( | |||
| <Typography | |||
| sx={{ | |||
| mr: { lg: 1 }, | |||
| mt: 6, | |||
| height: '100%', | |||
| textAlign: 'center', | |||
| fontSize: { xs: 36, md: 45 }, | |||
| mb: { md: 5 }, | |||
| }} | |||
| > | |||
| Your cart is currently empty | |||
| </Typography> | |||
| ); | |||
| return <EmptyCart />; | |||
| } | |||
| }; | |||
| return ( | |||
| <Box sx={{ py: 10, height: '100%', width: '100%' }}> | |||
| <PageWrapper> | |||
| <StepTitle title="Items in Your Cart" breadcrumbsArray={['Cart']} /> | |||
| <Box | |||
| sx={{ | |||
| display: 'flex', | |||
| flexDirection: { xs: 'column', md: 'row' }, | |||
| mr: { xs: 2, md: 12 }, | |||
| ml: { xs: 2, md: 12 }, | |||
| }} | |||
| > | |||
| <ContentContainer> | |||
| <Box sx={{ mt: 2, mr: { md: 2, minWidth: '65%' }, mb: { xs: 6 } }}> | |||
| {mapProductsToDom()} | |||
| </Box> | |||
| @@ -82,8 +64,8 @@ const CartContent = () => { | |||
| }} | |||
| ></OrderSummaryCard> | |||
| </Box> | |||
| </Box> | |||
| </Box> | |||
| </ContentContainer> | |||
| </PageWrapper> | |||
| ); | |||
| }; | |||
| @@ -1,4 +1,3 @@ | |||
| import { Typography } from '@mui/material'; | |||
| import { Box } from '@mui/system'; | |||
| import { useSession } from 'next-auth/react'; | |||
| import { useRouter } from 'next/router'; | |||
| @@ -6,9 +5,13 @@ import { setCookie } from 'nookies'; | |||
| import { useEffect, useState } from 'react'; | |||
| import { useStore } from '../../store/cart-context'; | |||
| import { useCheckoutDataUpdate } from '../../store/checkout-context'; | |||
| import CardContainer from '../cards/card-container/CardContainer'; | |||
| import DataCard from '../cards/data-card/DataCard'; | |||
| import ShippingDetailsForm from '../forms/shipping-details/ShippingDetailsForm'; | |||
| import ContentContainer from '../layout/content-wrapper/ContentContainer'; | |||
| import PageWrapper from '../layout/page-wrapper/PageWrapper'; | |||
| import StepTitle from '../layout/steps-title/StepTitle'; | |||
| import PageDescription from '../page-description/PageDescription'; | |||
| const CheckoutContent = () => { | |||
| const { cartStorage } = useStore(); | |||
| @@ -48,46 +51,26 @@ const CheckoutContent = () => { | |||
| }; | |||
| return ( | |||
| <Box sx={{ py: 10, height: '100%', width: '100%' }}> | |||
| <PageWrapper> | |||
| <StepTitle | |||
| title="Items in Your Cart" | |||
| breadcrumbsArray={['Cart', 'Checkout']} | |||
| /> | |||
| <Box sx={{ ml: { xs: 2, md: 12 }, my: 2 }}> | |||
| <Typography sx={{ fontSize: 20 }}> | |||
| The following fields will be used as the shipping details for your | |||
| order | |||
| </Typography> | |||
| </Box> | |||
| <Box | |||
| sx={{ | |||
| display: 'flex', | |||
| flexDirection: { xs: 'column', lg: 'row' }, | |||
| mr: { xs: 2, md: 12 }, | |||
| ml: { xs: 2, md: 12 }, | |||
| }} | |||
| > | |||
| <Box flexGrow={1}> | |||
| <PageDescription | |||
| description="The following fields will be used as the shipping details for your | |||
| order" | |||
| /> | |||
| <ContentContainer> | |||
| <Box flexGrow={1} sx={{ minWidth: '65%' }}> | |||
| <ShippingDetailsForm | |||
| backBtn={true} | |||
| isCheckout={true} | |||
| submitHandler={submitHandler} | |||
| ></ShippingDetailsForm> | |||
| </Box> | |||
| <Box | |||
| sx={{ | |||
| ml: { lg: 2 }, | |||
| mt: { xs: 5, md: 5, lg: 2 }, | |||
| display: 'flex', | |||
| flexDirection: { xs: 'column', sm: 'row', lg: 'column' }, | |||
| justifyContent: { sm: 'space-between', md: 'flex-start' }, | |||
| flexWrap: 'wrap', | |||
| }} | |||
| > | |||
| {mapProductsToDom()} | |||
| </Box> | |||
| </Box> | |||
| </Box> | |||
| <CardContainer>{mapProductsToDom()}</CardContainer> | |||
| </ContentContainer> | |||
| </PageWrapper> | |||
| ); | |||
| }; | |||
| @@ -0,0 +1,20 @@ | |||
| import { Typography } from '@mui/material'; | |||
| const EmptyCart = () => { | |||
| return ( | |||
| <Typography | |||
| sx={{ | |||
| mr: { lg: 1 }, | |||
| mt: 6, | |||
| height: '100%', | |||
| textAlign: 'center', | |||
| fontSize: { xs: 36, md: 45 }, | |||
| mb: { md: 5 }, | |||
| }} | |||
| > | |||
| Your cart is currently empty | |||
| </Typography> | |||
| ); | |||
| }; | |||
| export default EmptyCart; | |||
| @@ -0,0 +1,5 @@ | |||
| const GridItem = ({ children }) => { | |||
| return <p>Hello</p>; | |||
| }; | |||
| export default GridItem; | |||
| @@ -0,0 +1,18 @@ | |||
| import { Box } from '@mui/system'; | |||
| const ContentContainer = ({ children }) => { | |||
| return ( | |||
| <Box | |||
| sx={{ | |||
| display: 'flex', | |||
| flexDirection: { xs: 'column', md: 'row' }, | |||
| mr: { xs: 2, md: 12 }, | |||
| ml: { xs: 2, md: 12 }, | |||
| }} | |||
| > | |||
| {children} | |||
| </Box> | |||
| ); | |||
| }; | |||
| export default ContentContainer; | |||
| @@ -0,0 +1,7 @@ | |||
| import { Box } from '@mui/system'; | |||
| const PageWrapper = ({ children }) => { | |||
| return <Box sx={{ py: 10, height: '100%', width: '100%' }}>{children}</Box>; | |||
| }; | |||
| export default PageWrapper; | |||
| @@ -0,0 +1,12 @@ | |||
| import { Typography } from '@mui/material'; | |||
| import { Box } from '@mui/system'; | |||
| const PageDescription = ({ description }) => { | |||
| return ( | |||
| <Box sx={{ ml: { xs: 2, md: 12 }, my: 3 }}> | |||
| <Typography sx={{ fontSize: 20 }}>{description}</Typography> | |||
| </Box> | |||
| ); | |||
| }; | |||
| export default PageDescription; | |||
| @@ -4,8 +4,11 @@ import { useSession } from 'next-auth/react'; | |||
| import { useState } from 'react'; | |||
| import { updateUser } from '../../requests/user/userUpdateRequest'; | |||
| import { useUserUpdate } from '../../store/user-context'; | |||
| import CardContainer from '../cards/card-container/CardContainer'; | |||
| import OrderCard from '../cards/order-card/OrderCard'; | |||
| import ShippingDetailsForm from '../forms/shipping-details/ShippingDetailsForm'; | |||
| import ContentContainer from '../layout/content-wrapper/ContentContainer'; | |||
| import PageWrapper from '../layout/page-wrapper/PageWrapper'; | |||
| import StepTitle from '../layout/steps-title/StepTitle'; | |||
| const ProfileContent = ({ orders }) => { | |||
| @@ -48,8 +51,8 @@ const ProfileContent = ({ orders }) => { | |||
| )); | |||
| return ( | |||
| <Box sx={{ py: 10, height: '100%', width: '100%' }}> | |||
| <StepTitle title="Items in Your Cart" /> | |||
| <PageWrapper> | |||
| <StepTitle title="Welcome to your user account" /> | |||
| <Snackbar | |||
| anchorOrigin={{ vertical: 'top', horizontal: 'center' }} | |||
| open={open} | |||
| @@ -65,22 +68,8 @@ const ProfileContent = ({ orders }) => { | |||
| </Alert> | |||
| </Snackbar> | |||
| <Box | |||
| sx={{ | |||
| display: 'flex', | |||
| flexDirection: { xs: 'column', md: 'row' }, | |||
| mr: { xs: 2, md: 12 }, | |||
| ml: { xs: 2, md: 12 }, | |||
| }} | |||
| > | |||
| <Box | |||
| sx={{ | |||
| width: { xs: '100%', md: '100%' }, | |||
| mt: 2, | |||
| mr: { md: 2 }, | |||
| mb: { xs: 6 }, | |||
| }} | |||
| > | |||
| <ContentContainer> | |||
| <Box flexGrow={1} sx={{ minWidth: '65%' }}> | |||
| <Typography sx={{ fontSize: 20, mb: 3 }}> | |||
| Save details for later | |||
| </Typography> | |||
| @@ -89,19 +78,16 @@ const ProfileContent = ({ orders }) => { | |||
| enableBtn={enableBtn} | |||
| ></ShippingDetailsForm> | |||
| </Box> | |||
| <Box | |||
| sx={{ | |||
| mt: 2, | |||
| maxWidth: { sm: '100%', lg: '10%' }, | |||
| minWidth: { md: '40%' }, | |||
| }} | |||
| > | |||
| <Typography sx={{ fontSize: 20, mb: 3 }}>Previous Orders</Typography> | |||
| {mapOrdersToDom()} | |||
| <Box sx={{ mt: { xs: 5, md: 0 } }}> | |||
| <Typography | |||
| sx={{ fontSize: 20, mb: { xs: -2, md: 3 }, ml: { md: 3 } }} | |||
| > | |||
| Previous Orders | |||
| </Typography> | |||
| <CardContainer>{mapOrdersToDom()}</CardContainer> | |||
| </Box> | |||
| </Box> | |||
| </Box> | |||
| </ContentContainer> | |||
| </PageWrapper> | |||
| ); | |||
| }; | |||
| @@ -10,6 +10,7 @@ import { | |||
| useCheckoutData, | |||
| useCheckoutDataUpdate, | |||
| } from '../../store/checkout-context'; | |||
| import PageWrapper from '../layout/page-wrapper/PageWrapper'; | |||
| import StepTitle from '../layout/steps-title/StepTitle'; | |||
| let initialRender = true; | |||
| @@ -44,7 +45,7 @@ const ReviewContent = () => { | |||
| }, [checkoutStorage]); | |||
| return ( | |||
| <Box sx={{ py: 10, height: '100%', width: '100%' }}> | |||
| <PageWrapper> | |||
| <StepTitle | |||
| title="Review" | |||
| breadcrumbsArray={['Cart', 'Checkout', 'Shipping', 'Payment', 'Review']} | |||
| @@ -182,7 +183,7 @@ const ReviewContent = () => { | |||
| </Box> | |||
| </Box> | |||
| </Box> | |||
| </Box> | |||
| </PageWrapper> | |||
| ); | |||
| }; | |||
| @@ -1,4 +1,4 @@ | |||
| import { Checkbox, FormControlLabel, Typography } from '@mui/material'; | |||
| import { Checkbox, FormControlLabel } from '@mui/material'; | |||
| import { Box } from '@mui/system'; | |||
| import { useRouter } from 'next/router'; | |||
| import { setCookie } from 'nookies'; | |||
| @@ -8,8 +8,12 @@ import { | |||
| useCheckoutDataUpdate, | |||
| } from '../../store/checkout-context'; | |||
| import { stripe } from '../../utils/helpers/stripe'; | |||
| import CardContainer from '../cards/card-container/CardContainer'; | |||
| import DataCard from '../cards/data-card/DataCard'; | |||
| import ContentContainer from '../layout/content-wrapper/ContentContainer'; | |||
| import PageWrapper from '../layout/page-wrapper/PageWrapper'; | |||
| import StepTitle from '../layout/steps-title/StepTitle'; | |||
| import PageDescription from '../page-description/PageDescription'; | |||
| import ButtonGroup from './shipping-btnGroup/ButtonGroup'; | |||
| import ShippingData from './shipping-data/ShippingData'; | |||
| import ShippingModal from './shipping-modal/ShippingModal'; | |||
| @@ -69,25 +73,17 @@ const ShippingContent = () => { | |||
| }; | |||
| return ( | |||
| <Box container spacing={2} sx={{ py: 10, height: '100%', width: '100%' }}> | |||
| <PageWrapper> | |||
| <StepTitle | |||
| title="Shipping" | |||
| breadcrumbsArray={['Cart', 'Checkout', 'Shipping']} | |||
| /> | |||
| <Box sx={{ ml: { xs: 2, md: 12 }, my: 2 }}> | |||
| <Typography sx={{ fontSize: 20 }}> | |||
| The following fields will be used as the shipping details for your | |||
| order | |||
| </Typography> | |||
| </Box> | |||
| <Box | |||
| sx={{ | |||
| display: 'flex', | |||
| flexDirection: { xs: 'column', lg: 'row' }, | |||
| mr: { xs: 2, md: 12 }, | |||
| }} | |||
| > | |||
| <Box flexGrow={1} sx={{ minWidth: '65%', ml: { xs: 2, md: 12 } }}> | |||
| <PageDescription | |||
| description="The following fields will be used as the shipping details for your | |||
| order" | |||
| /> | |||
| <ContentContainer> | |||
| <Box flexGrow={1} sx={{ minWidth: '65%' }}> | |||
| <ShippingData | |||
| email={checkoutData?.userInfo?.email} | |||
| address={checkoutData?.userInfo?.address} | |||
| @@ -118,26 +114,15 @@ const ShippingContent = () => { | |||
| handleBackToCart={handleBackToCart} | |||
| /> | |||
| </Box> | |||
| <Box | |||
| sx={{ | |||
| ml: { xs: 2, md: 12, lg: 2 }, | |||
| mt: { xs: 5, md: 5, lg: 2 }, | |||
| display: 'flex', | |||
| flexDirection: { xs: 'column', sm: 'row', lg: 'column' }, | |||
| justifyContent: { sm: 'flex-start' }, | |||
| flexWrap: 'wrap', | |||
| }} | |||
| > | |||
| {mapProductsToDom()} | |||
| </Box> | |||
| </Box> | |||
| <CardContainer>{mapProductsToDom()}</CardContainer> | |||
| </ContentContainer> | |||
| <ShippingModal | |||
| open={open} | |||
| handleClose={handleClose} | |||
| handleChangeShipping={handleChangeShipping} | |||
| handleChangeContact={handleChangeContact} | |||
| /> | |||
| </Box> | |||
| </PageWrapper> | |||
| ); | |||
| }; | |||
| @@ -11,7 +11,6 @@ const ShippingData = ({ email, address, city, postcode, handleOpen }) => { | |||
| justifyContent: 'space-between', | |||
| backgroundColor: '#f2f2f2', | |||
| alignItems: 'center', | |||
| mt: 2, | |||
| mb: 2, | |||
| borderRadius: 2, | |||
| p: 1, | |||