| <Paper | <Paper | ||||
| sx={{ | sx={{ | ||||
| p: 1, | p: 1, | ||||
| width: { lg: '88%', xs: '80%' }, | |||||
| width: { lg: '88%', xs: '73%', md: '80%' }, | |||||
| mb: 2, | mb: 2, | ||||
| ml: 12, | ml: 12, | ||||
| backgroundColor: '#f2f2f2', | backgroundColor: '#f2f2f2', | ||||
| display: 'flex', | display: 'flex', | ||||
| justifyContent: { xs: 'center', md: 'none' }, | |||||
| }} | }} | ||||
| elevation={3} | elevation={3} | ||||
| > | > | ||||
| <Box sx={{ width: '30%' }}> | |||||
| <Box sx={{ width: '30%', display: { xs: 'none', md: 'block' } }}> | |||||
| <Image | <Image | ||||
| src="/images/coffee-mug.svg" | src="/images/coffee-mug.svg" | ||||
| alt="profile" | alt="profile" | ||||
| textAlign: 'center', | textAlign: 'center', | ||||
| height: 25, | height: 25, | ||||
| fontWeight: 600, | fontWeight: 600, | ||||
| fontSize: 20, | |||||
| ml: { xs: -1, sm: 0 }, | |||||
| fontSize: { xs: 16, sm: 20 }, | |||||
| }} | }} | ||||
| > | > | ||||
| {product?.name} | {product?.name} | ||||
| width: '20%', | width: '20%', | ||||
| justifyContent: 'center', | justifyContent: 'center', | ||||
| alignItems: 'center', | alignItems: 'center', | ||||
| ml: { xs: 2, sm: 0 }, | |||||
| }} | }} | ||||
| > | > | ||||
| <Typography | <Typography | ||||
| </Box> | </Box> | ||||
| <Box | <Box | ||||
| sx={{ | sx={{ | ||||
| ml: 3, | |||||
| ml: { xs: 5, sm: 3 }, | |||||
| display: 'flex', | display: 'flex', | ||||
| flexDirection: 'column', | flexDirection: 'column', | ||||
| width: '20%', | width: '20%', | ||||
| width: '100%', | width: '100%', | ||||
| textAlign: 'center', | textAlign: 'center', | ||||
| height: 25, | height: 25, | ||||
| fontSize: 18, | |||||
| fontSize: { xs: 15, md: 18 }, | |||||
| }} | }} | ||||
| > | > | ||||
| Price: ${product?.price} | Price: ${product?.price} |
| <Paper | <Paper | ||||
| sx={{ | sx={{ | ||||
| p: 3, | p: 3, | ||||
| width: '100%', | |||||
| width: { lg: '100%', xs: '35%' }, | |||||
| mb: 2, | mb: 2, | ||||
| ml: { lg: 0, xs: 6 }, | |||||
| backgroundColor: '#f2f2f2', | backgroundColor: '#f2f2f2', | ||||
| display: 'flex', | display: 'flex', | ||||
| flex: { xs: [0, 0, '32%'], lg: 'none' }, | |||||
| }} | }} | ||||
| elevation={3} | elevation={3} | ||||
| > | > | ||||
| <Box sx={{ width: '30%', borderRadius: 4, overflow: 'hidden' }}> | |||||
| <Box | |||||
| sx={{ | |||||
| width: '30%', | |||||
| borderRadius: 4, | |||||
| overflow: 'hidden', | |||||
| display: { xs: 'none', lg: 'block' }, | |||||
| }} | |||||
| > | |||||
| <Image | <Image | ||||
| src="/images/coffee-mug.svg" | src="/images/coffee-mug.svg" | ||||
| alt="profile" | alt="profile" | ||||
| /> | /> | ||||
| </Box> | </Box> | ||||
| <Box | <Box | ||||
| sx={{ ml: 3, display: 'flex', flexDirection: 'column', width: '60%' }} | |||||
| sx={{ | |||||
| ml: 3, | |||||
| display: 'flex', | |||||
| flexDirection: 'column', | |||||
| width: { lg: '60%', sx: '100%' }, | |||||
| }} | |||||
| > | > | ||||
| <Typography | <Typography | ||||
| sx={{ | sx={{ | ||||
| textAlign: 'center', | textAlign: 'center', | ||||
| height: 25, | height: 25, | ||||
| fontWeight: 600, | fontWeight: 600, | ||||
| fontSize: 20, | |||||
| fontSize: { md: 20, xs: 16 }, | |||||
| }} | }} | ||||
| > | > | ||||
| {data.name} - x{quantity} | {data.name} - x{quantity} | ||||
| </Typography> | </Typography> | ||||
| <Typography | <Typography | ||||
| sx={{ | sx={{ | ||||
| mt: 3, | |||||
| mt: { sm: 3, xs: 6 }, | |||||
| fontSize: 14, | fontSize: 14, | ||||
| }} | }} | ||||
| > | > | ||||
| </Typography> | </Typography> | ||||
| <Typography | <Typography | ||||
| sx={{ | sx={{ | ||||
| mt: 3, | |||||
| mt: { lg: 3, xs: 1 }, | |||||
| textAlign: 'right', | textAlign: 'right', | ||||
| fontSize: 14, | fontSize: 14, | ||||
| }} | }} |
| order | order | ||||
| </Typography> | </Typography> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={8}> | |||||
| <Grid item lg={8} xs={12}> | |||||
| <ShippingDetailsForm | <ShippingDetailsForm | ||||
| backBtn={true} | backBtn={true} | ||||
| isCheckout={true} | isCheckout={true} | ||||
| submitHandler={submitHandler} | submitHandler={submitHandler} | ||||
| ></ShippingDetailsForm> | ></ShippingDetailsForm> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={4}> | |||||
| <Box sx={{ width: '80%', mt: 2 }}>{mapProductsToDom()}</Box> | |||||
| <Grid item lg={4} xs={12}> | |||||
| <Box | |||||
| sx={{ | |||||
| width: '80%', | |||||
| mt: 2, | |||||
| height: '100%', | |||||
| ml: { xs: 12, lg: 0 }, | |||||
| display: { lg: 'block', xs: 'flex' }, | |||||
| flexWrap: { xs: 'wrap', lg: 'none' }, | |||||
| justifyContent: { xs: 'center', lg: 'none' }, | |||||
| }} | |||||
| > | |||||
| {mapProductsToDom()} | |||||
| </Box> | |||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| ); | ); |
| import { Box, Button, Paper, TextField } from '@mui/material'; | import { Box, Button, Paper, TextField } from '@mui/material'; | ||||
| import { useFormik } from 'formik'; | import { useFormik } from 'formik'; | ||||
| import { useSession } from 'next-auth/react'; | import { useSession } from 'next-auth/react'; | ||||
| import { useRouter } from 'next/router'; | |||||
| import PropType from 'prop-types'; | import PropType from 'prop-types'; | ||||
| import { useState } from 'react'; | import { useState } from 'react'; | ||||
| import { shippingDetailsSchema } from '../../../schemas/shippingDetailsSchema'; | import { shippingDetailsSchema } from '../../../schemas/shippingDetailsSchema'; | ||||
| }) => { | }) => { | ||||
| const [error] = useState({ hasError: false, errorMessage: '' }); | const [error] = useState({ hasError: false, errorMessage: '' }); | ||||
| const { data: session } = useSession(); | const { data: session } = useSession(); | ||||
| const router = useRouter(); | |||||
| const formikSubmitHandler = async (values) => { | const formikSubmitHandler = async (values) => { | ||||
| submitHandler(values); | submitHandler(values); | ||||
| color: 'white', | color: 'white', | ||||
| mr: 2, | mr: 2, | ||||
| }} | }} | ||||
| onClick={() => { | |||||
| router.push('/cart'); | |||||
| }} | |||||
| > | > | ||||
| Back to cart | Back to cart | ||||
| </Button> | </Button> |
| flexGrow: 1, | flexGrow: 1, | ||||
| maxWidth: '50%', | maxWidth: '50%', | ||||
| height: 30, | height: 30, | ||||
| display: { xs: 'none', md: 'flex' }, | |||||
| display: 'flex', | |||||
| px: 10, | px: 10, | ||||
| }} | }} | ||||
| > | > | ||||
| textAlign="center" | textAlign="center" | ||||
| sx={{ | sx={{ | ||||
| mx: 'auto', | mx: 'auto', | ||||
| fontSize: 20, | |||||
| fontSize: { md: 20, xs: 17 }, | |||||
| fontWeight: 500, | fontWeight: 500, | ||||
| mr: { lg: 0, xs: 2 }, | |||||
| color: router.pathname === '/' ? 'white' : 'black', | color: router.pathname === '/' ? 'white' : 'black', | ||||
| textDecoration: 'none', | textDecoration: 'none', | ||||
| cursor: 'pointer', | cursor: 'pointer', | ||||
| textAlign="center" | textAlign="center" | ||||
| sx={{ | sx={{ | ||||
| mx: 'auto', | mx: 'auto', | ||||
| fontSize: 20, | |||||
| fontSize: { md: 20, xs: 17 }, | |||||
| fontWeight: 500, | fontWeight: 500, | ||||
| mr: { lg: 0, xs: 2 }, | |||||
| color: router.pathname === '/' ? 'white' : 'black', | color: router.pathname === '/' ? 'white' : 'black', | ||||
| textDecoration: 'none', | textDecoration: 'none', | ||||
| cursor: 'pointer', | cursor: 'pointer', | ||||
| textAlign="center" | textAlign="center" | ||||
| sx={{ | sx={{ | ||||
| mx: 'auto', | mx: 'auto', | ||||
| fontSize: 20, | |||||
| fontSize: { md: 20, xs: 17 }, | |||||
| fontWeight: 500, | fontWeight: 500, | ||||
| mr: { lg: 0, xs: 2 }, | |||||
| color: router.pathname === '/' ? 'white' : 'black', | color: router.pathname === '/' ? 'white' : 'black', | ||||
| textDecoration: 'none', | textDecoration: 'none', | ||||
| cursor: 'pointer', | cursor: 'pointer', | ||||
| textAlign="center" | textAlign="center" | ||||
| sx={{ | sx={{ | ||||
| mx: 'auto', | mx: 'auto', | ||||
| fontSize: 20, | |||||
| fontSize: { md: 20, xs: 17 }, | |||||
| fontWeight: 500, | fontWeight: 500, | ||||
| mr: { lg: 0, xs: 2 }, | |||||
| color: router.pathname === '/' ? 'white' : 'black', | color: router.pathname === '/' ? 'white' : 'black', | ||||
| textDecoration: 'none', | textDecoration: 'none', | ||||
| cursor: 'pointer', | cursor: 'pointer', | ||||
| textAlign="center" | textAlign="center" | ||||
| sx={{ | sx={{ | ||||
| mx: 'auto', | mx: 'auto', | ||||
| fontSize: 20, | |||||
| fontSize: { md: 20, xs: 17 }, | |||||
| fontWeight: 500, | fontWeight: 500, | ||||
| color: router.pathname === '/' ? 'white' : 'black', | color: router.pathname === '/' ? 'white' : 'black', | ||||
| textDecoration: 'none', | textDecoration: 'none', | ||||
| flexGrow: 1, | flexGrow: 1, | ||||
| maxWidth: '50%', | maxWidth: '50%', | ||||
| height: 30, | height: 30, | ||||
| display: { xs: 'none', md: 'flex' }, | |||||
| display: 'flex', | |||||
| justifyContent: 'right', | justifyContent: 'right', | ||||
| pt: 0.5, | pt: 0.5, | ||||
| mr: 4, | mr: 4, |
| useCheckoutDataUpdate, | useCheckoutDataUpdate, | ||||
| } from '../../store/checkout-context'; | } from '../../store/checkout-context'; | ||||
| import { stripe } from '../../utils/helpers/stripe'; | import { stripe } from '../../utils/helpers/stripe'; | ||||
| //import DataCardS from '../cards/data-card-shipping/DataCardS'; | |||||
| import DataCard from '../cards/data-card/DataCard'; | import DataCard from '../cards/data-card/DataCard'; | ||||
| import StepTitle from '../layout/steps-title/StepTitle'; | import StepTitle from '../layout/steps-title/StepTitle'; | ||||
| import ButtonGroup from './shipping-btnGroup/ButtonGroup'; | import ButtonGroup from './shipping-btnGroup/ButtonGroup'; | ||||
| order | order | ||||
| </Typography> | </Typography> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={8}> | |||||
| <Grid item xs={12} lg={8}> | |||||
| <ShippingData | <ShippingData | ||||
| email={checkoutStorage?.userInfo?.email} | email={checkoutStorage?.userInfo?.email} | ||||
| address={checkoutStorage?.userInfo?.address} | address={checkoutStorage?.userInfo?.address} | ||||
| handleBackToCart={handleBackToCart} | handleBackToCart={handleBackToCart} | ||||
| /> | /> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={4}> | |||||
| <Box sx={{ width: '80%', mt: 2 }}>{mapProductsToDom()}</Box> | |||||
| <Grid item xs={12} lg={4}> | |||||
| <Box | |||||
| sx={{ | |||||
| width: '80%', | |||||
| mt: 2, | |||||
| height: '100%', | |||||
| ml: { xs: 12, lg: 0 }, | |||||
| display: { lg: 'block', xs: 'flex' }, | |||||
| flexWrap: { xs: 'wrap', lg: 'none' }, | |||||
| justifyContent: { xs: 'center', lg: 'none' }, | |||||
| }} | |||||
| > | |||||
| {mapProductsToDom()} | |||||
| </Box> | |||||
| </Grid> | </Grid> | ||||
| <ShippingModal | <ShippingModal | ||||
| open={open} | open={open} |
| mt: 2, | mt: 2, | ||||
| ml: 12, | ml: 12, | ||||
| mb: 2, | mb: 2, | ||||
| width: '90%', | |||||
| width: { lg: '90%', xs: '80%' }, | |||||
| borderRadius: 2, | borderRadius: 2, | ||||
| p: 1, | p: 1, | ||||
| }} | }} | ||||
| <Button | <Button | ||||
| sx={{ | sx={{ | ||||
| height: 35, | height: 35, | ||||
| width: 125, | |||||
| minWidth: { md: 125, xs: 90 }, | |||||
| fontSize: 15, | fontSize: 15, | ||||
| textTransform: 'none', | textTransform: 'none', | ||||
| backgroundColor: '#CBA213', | backgroundColor: '#CBA213', | ||||
| alignItems: 'center', | alignItems: 'center', | ||||
| ml: 12, | ml: 12, | ||||
| mb: 2, | mb: 2, | ||||
| width: '90%', | |||||
| width: { lg: '90%', xs: '80%' }, | |||||
| borderRadius: 2, | borderRadius: 2, | ||||
| p: 1, | p: 1, | ||||
| }} | }} | ||||
| > | > | ||||
| <Typography sx={{ fontSize: 18, fontWeight: 600 }}> | |||||
| <Typography | |||||
| sx={{ | |||||
| fontSize: { md: 18, xs: 16 }, | |||||
| fontWeight: 600, | |||||
| mr: { xs: 1, sm: 0 }, | |||||
| }} | |||||
| > | |||||
| Shipping to | Shipping to | ||||
| </Typography> | </Typography> | ||||
| <Typography> | <Typography> | ||||
| <Button | <Button | ||||
| sx={{ | sx={{ | ||||
| height: 35, | height: 35, | ||||
| width: 125, | |||||
| minWidth: { md: 125, xs: 90 }, | |||||
| fontSize: 15, | fontSize: 15, | ||||
| textTransform: 'none', | textTransform: 'none', | ||||
| backgroundColor: '#CBA213', | backgroundColor: '#CBA213', |