| return ( | return ( | ||||
| <Card | <Card | ||||
| sx={{ | sx={{ | ||||
| ml: 10, | |||||
| mr: { sm: 10, lg: 1 }, | |||||
| ml: { xs: 2, md: 10 }, | |||||
| mr: { xs: 1, md: 10, lg: 1 }, | |||||
| backgroundColor: '#f2f2f2', | backgroundColor: '#f2f2f2', | ||||
| p: 2, | p: 2, | ||||
| mb: 2, | mb: 2, | ||||
| </Button> | </Button> | ||||
| </ButtonGroup> | </ButtonGroup> | ||||
| <Button | <Button | ||||
| disableRipple | |||||
| sx={{ | sx={{ | ||||
| height: 35, | height: 35, | ||||
| mt: 1, | mt: 1, | ||||
| width: 125, | |||||
| width: 118, | |||||
| fontSize: 15, | fontSize: 15, | ||||
| textTransform: 'none', | textTransform: 'none', | ||||
| backgroundColor: '#C6453E', | backgroundColor: '#C6453E', |
| import { Box, Paper, Typography } from '@mui/material'; | |||||
| import { Box, Card, Typography } from '@mui/material'; | |||||
| import Image from 'next/image'; | import Image from 'next/image'; | ||||
| import PropType from 'prop-types'; | import PropType from 'prop-types'; | ||||
| const DataCard = ({ data, quantity }) => { | const DataCard = ({ data, quantity }) => { | ||||
| return ( | return ( | ||||
| <Paper | |||||
| <Card | |||||
| height="100%" | |||||
| sx={{ | sx={{ | ||||
| p: 3, | |||||
| width: { lg: '100%', xs: '35%' }, | |||||
| mb: 2, | |||||
| ml: { lg: 0, xs: 6 }, | |||||
| backgroundColor: '#f2f2f2', | backgroundColor: '#f2f2f2', | ||||
| display: 'flex', | |||||
| flex: { xs: [0, 0, '32%'], lg: 'none' }, | |||||
| mb: 2, | |||||
| py: 2, | |||||
| mx: { xs: 0, sm: 1 }, | |||||
| width: { xs: '100%', sm: '44%', md: '30%', lg: '100%' }, | |||||
| }} | }} | ||||
| elevation={3} | |||||
| > | > | ||||
| <Box | <Box | ||||
| sx={{ | sx={{ | ||||
| width: '30%', | |||||
| display: { xs: 'none', lg: 'flex' }, | |||||
| }} | |||||
| > | |||||
| <Image | |||||
| src="/images/coffee-mug.svg" | |||||
| alt="profile" | |||||
| width={200} | |||||
| height={250} | |||||
| /> | |||||
| </Box> | |||||
| <Box | |||||
| sx={{ | |||||
| ml: { xs: 0, md: 3 }, | |||||
| display: 'flex', | display: 'flex', | ||||
| flexDirection: 'column', | |||||
| flexDirection: { xs: 'column', lg: 'row' }, | |||||
| }} | }} | ||||
| > | > | ||||
| <Typography | |||||
| <Box sx={{ display: 'flex', justifyContent: 'center' }}> | |||||
| <Image | |||||
| src="/images/coffee-mug.svg" | |||||
| alt="profile" | |||||
| width={200} | |||||
| height={200} | |||||
| /> | |||||
| </Box> | |||||
| <Box | |||||
| sx={{ | sx={{ | ||||
| width: '100%', | width: '100%', | ||||
| textAlign: 'center', | |||||
| fontWeight: 600, | |||||
| fontSize: { md: 20, xs: 16 }, | |||||
| }} | |||||
| > | |||||
| {data.name} | |||||
| </Typography> | |||||
| <Typography | |||||
| sx={{ | |||||
| width: '100%', | |||||
| textAlign: 'center', | |||||
| fontWeight: 600, | |||||
| fontSize: { md: 20, xs: 16 }, | |||||
| }} | |||||
| > | |||||
| x{quantity} | |||||
| </Typography> | |||||
| <Typography | |||||
| sx={{ | |||||
| mt: { lg: 3, xs: 1 }, | |||||
| textAlign: 'center', | |||||
| fontSize: 14, | |||||
| display: 'flex', | |||||
| flexDirection: 'column', | |||||
| alignItems: 'center', | |||||
| justifyItems: 'center', | |||||
| }} | }} | ||||
| > | > | ||||
| ${data.price} (per unit) | |||||
| </Typography> | |||||
| <Typography | |||||
| sx={{ | |||||
| textAlign: 'center', | |||||
| fontWeight: 600, | |||||
| fontSize: { md: 20, xs: 16 }, | |||||
| pt: { xs: 2 }, | |||||
| }} | |||||
| > | |||||
| {data.name} | |||||
| </Typography> | |||||
| <Typography | |||||
| sx={{ | |||||
| width: '100%', | |||||
| textAlign: 'center', | |||||
| fontWeight: 600, | |||||
| fontSize: { md: 20, xs: 16 }, | |||||
| }} | |||||
| > | |||||
| x{quantity} | |||||
| </Typography> | |||||
| <Typography | |||||
| sx={{ | |||||
| mt: { lg: 3, xs: 1 }, | |||||
| textAlign: 'center', | |||||
| fontSize: 14, | |||||
| }} | |||||
| > | |||||
| ${data.price} (per unit) | |||||
| </Typography> | |||||
| </Box> | |||||
| </Box> | </Box> | ||||
| </Paper> | |||||
| </Card> | |||||
| ); | ); | ||||
| }; | }; | ||||
| {mapProductsToDom()} | {mapProductsToDom()} | ||||
| </Grid> | </Grid> | ||||
| <Grid item lg={4} xs={12}> | <Grid item lg={4} xs={12}> | ||||
| <Box sx={{ mr: { xs: 10 }, mt: 2, pl: { xs: 10, lg: 0 } }}> | |||||
| <Box sx={{ mr: { md: 12 }, mt: 2, ml: { xs: 2, md: 12, lg: 0 } }}> | |||||
| <OrderSummaryCard | <OrderSummaryCard | ||||
| data={{ totalPrice: totalPrice, totalQuantity: totalQuantity }} | data={{ totalPrice: totalPrice, totalQuantity: totalQuantity }} | ||||
| ></OrderSummaryCard> | ></OrderSummaryCard> |
| import { Grid, Typography } from '@mui/material'; | |||||
| import { Typography } from '@mui/material'; | |||||
| import { Box } from '@mui/system'; | import { Box } from '@mui/system'; | ||||
| import { useSession } from 'next-auth/react'; | import { useSession } from 'next-auth/react'; | ||||
| import { useRouter } from 'next/router'; | import { useRouter } from 'next/router'; | ||||
| }; | }; | ||||
| return ( | return ( | ||||
| <Grid container spacing={2} sx={{ py: 10, height: '100%', width: '100%' }}> | |||||
| <Box container spacing={2} sx={{ py: 10, height: '100%', width: '100%' }}> | |||||
| <StepTitle | <StepTitle | ||||
| title="Items in Your Cart" | title="Items in Your Cart" | ||||
| breadcrumbsArray={['Cart', 'Checkout']} | breadcrumbsArray={['Cart', 'Checkout']} | ||||
| /> | /> | ||||
| <Grid item xs={12} sx={{ mt: 1 }}> | |||||
| <Typography sx={{ pl: 12, fontSize: 20 }}> | |||||
| <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 | The following fields will be used as the shipping details for your | ||||
| order | order | ||||
| </Typography> | </Typography> | ||||
| </Grid> | |||||
| <Grid item lg={8} xs={12}> | |||||
| <ShippingDetailsForm | |||||
| backBtn={true} | |||||
| isCheckout={true} | |||||
| submitHandler={submitHandler} | |||||
| ></ShippingDetailsForm> | |||||
| </Grid> | |||||
| <Grid item lg={4} xs={12}> | |||||
| </Box> | |||||
| <Box | |||||
| sx={{ | |||||
| display: 'flex', | |||||
| flexDirection: { xs: 'column', lg: 'row' }, | |||||
| mr: { xs: 2, md: 12 }, | |||||
| ml: { xs: 2, md: 12 }, | |||||
| }} | |||||
| > | |||||
| <Box flexGrow={1}> | |||||
| <ShippingDetailsForm | |||||
| backBtn={true} | |||||
| isCheckout={true} | |||||
| submitHandler={submitHandler} | |||||
| ></ShippingDetailsForm> | |||||
| </Box> | |||||
| <Box | <Box | ||||
| sx={{ | 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' }, | |||||
| 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()} | {mapProductsToDom()} | ||||
| </Box> | </Box> | ||||
| </Grid> | |||||
| </Grid> | |||||
| </Box> | |||||
| </Box> | |||||
| ); | ); | ||||
| }; | }; | ||||
| }); | }); | ||||
| return ( | return ( | ||||
| <Paper | |||||
| sx={{ p: 3, width: '90%', ml: 12, mt: 2, backgroundColor: '#f2f2f2' }} | |||||
| elevation={3} | |||||
| > | |||||
| <Paper sx={{ p: 3, mt: 2, backgroundColor: '#f2f2f2' }} elevation={3}> | |||||
| <Box | <Box | ||||
| sx={{ | sx={{ | ||||
| width: '100%', | width: '100%', |
| <Grid item xs={12}> | <Grid item xs={12}> | ||||
| <Typography | <Typography | ||||
| variant="h3" | variant="h3" | ||||
| sx={{ pl: 12, mt: 12, height: '100%', color: 'primary.main' }} | |||||
| sx={{ | |||||
| ml: { xs: 2, md: 12 }, | |||||
| mt: 12, | |||||
| height: '100%', | |||||
| color: 'primary.main', | |||||
| }} | |||||
| > | > | ||||
| {title} | {title} | ||||
| </Typography> | </Typography> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12}> | <Grid item xs={12}> | ||||
| <Divider sx={{ backgroundColor: 'primary.main', mx: 12 }} /> | |||||
| <Divider | |||||
| sx={{ | |||||
| backgroundColor: 'primary.main', | |||||
| ml: { xs: 2, md: 12 }, | |||||
| mr: { xs: 2, md: 12 }, | |||||
| }} | |||||
| /> | |||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} sx={{ mt: 4 }}> | <Grid item xs={12} sx={{ mt: 4 }}> | ||||
| <Breadcrumbs | <Breadcrumbs | ||||
| aria-label="breadcrumb" | aria-label="breadcrumb" | ||||
| separator={<NavigateNextIcon fontSize="small" />} | separator={<NavigateNextIcon fontSize="small" />} | ||||
| sx={{ pl: 12, fontSize: 20 }} | |||||
| sx={{ ml: { xs: 2, md: 12 }, fontSize: 20 }} | |||||
| > | > | ||||
| {breadcrumbsArray.map((entry, index) => { | {breadcrumbsArray.map((entry, index) => { | ||||
| return ( | return ( | ||||
| <Typography | <Typography | ||||
| fontSize="20px" | |||||
| sx={{ fontSize: { xs: '16px', md: '22px' } }} | |||||
| key={index} | key={index} | ||||
| color={index === breadcrumbsArray.length - 1 ? 'red' : 'black'} | color={index === breadcrumbsArray.length - 1 ? 'red' : 'black'} | ||||
| > | > | ||||
| </Typography> | </Typography> | ||||
| ); | ); | ||||
| })} | })} | ||||
| <Typography></Typography> | |||||
| </Breadcrumbs> | </Breadcrumbs> | ||||
| </Grid> | </Grid> | ||||
| </> | </> |
| disabled={inCart} | disabled={inCart} | ||||
| onClick={() => addProductToCart(1)} | onClick={() => addProductToCart(1)} | ||||
| sx={{ | sx={{ | ||||
| '&.Mui-disabled': { | |||||
| backgroundColor: '#f2d675', | |||||
| color: '#464646', | |||||
| }, | |||||
| '&:hover': { | |||||
| backgroundColor: '#f2d675', | |||||
| color: '#464646', | |||||
| boxShadow: 'none', | |||||
| }, | |||||
| backgroundColor: '#CBA213', | backgroundColor: '#CBA213', | ||||
| height: 50, | height: 50, | ||||
| width: 150, | width: 150, |
| import { Button, Container, Grid } from '@mui/material'; | import { Button, Container, Grid } from '@mui/material'; | ||||
| import CircularProgress from '@mui/material/CircularProgress'; | |||||
| import { Box } from '@mui/system'; | import { Box } from '@mui/system'; | ||||
| import Image from 'next/image'; | import Image from 'next/image'; | ||||
| import ProductCard from '../product-card/ProductCard'; | import ProductCard from '../product-card/ProductCard'; | ||||
| const ProductsGrid = ({ allProducts, hasNextPage, fetchNextPage }) => { | |||||
| const ProductsGrid = ({ | |||||
| allProducts, | |||||
| hasNextPage, | |||||
| fetchNextPage, | |||||
| isFetchingNextPage, | |||||
| }) => { | |||||
| const dataToDisplay = allProducts.pages.map((page) => | const dataToDisplay = allProducts.pages.map((page) => | ||||
| page.product.map((item) => ( | page.product.map((item) => ( | ||||
| <Grid key={item._id} item md={4} sm={6} xs={12} sx={{ mb: '100px' }}> | <Grid key={item._id} item md={4} sm={6} xs={12} sx={{ mb: '100px' }}> | ||||
| <Button | <Button | ||||
| onClick={fetchNextPage} | onClick={fetchNextPage} | ||||
| startIcon={ | startIcon={ | ||||
| <Image | |||||
| src="/images/arrow.svg" | |||||
| alt="arrow down" | |||||
| width={29} | |||||
| height={29} | |||||
| /> | |||||
| !isFetchingNextPage && ( | |||||
| <Image | |||||
| src="/images/arrow.svg" | |||||
| alt="arrow down" | |||||
| width={29} | |||||
| height={29} | |||||
| /> | |||||
| ) | |||||
| } | } | ||||
| sx={{ | sx={{ | ||||
| backgroundColor: 'primary.main', | backgroundColor: 'primary.main', | ||||
| }, | }, | ||||
| }} | }} | ||||
| > | > | ||||
| Load More | |||||
| {isFetchingNextPage && ( | |||||
| <CircularProgress | |||||
| style={{ | |||||
| color: '#fff', | |||||
| width: '29px', | |||||
| height: '29px', | |||||
| marginRight: '20px', | |||||
| }} | |||||
| /> | |||||
| )} | |||||
| {isFetchingNextPage | |||||
| ? 'Loading...' | |||||
| : hasNextPage | |||||
| ? 'Load More' | |||||
| : 'Nothing more to load'} | |||||
| </Button> | </Button> | ||||
| )} | )} | ||||
| </Box> | </Box> |
| }} | }} | ||||
| > | > | ||||
| <ButtonGroup | <ButtonGroup | ||||
| disabled={inCart} | |||||
| size="small" | size="small" | ||||
| aria-label="small outlined button group" | aria-label="small outlined button group" | ||||
| sx={{ | sx={{ | ||||
| height: 50, | height: 50, | ||||
| width: 150, | width: 150, | ||||
| color: 'white', | color: 'white', | ||||
| '&.Mui-disabled': { | |||||
| backgroundColor: '#f2d675', | |||||
| color: '#464646', | |||||
| }, | |||||
| '&:hover': { | |||||
| backgroundColor: '#f2d675', | |||||
| color: '#464646', | |||||
| boxShadow: 'none', | |||||
| }, | |||||
| }} | }} | ||||
| disabled={inCart} | disabled={inCart} | ||||
| onClick={() => addProductToCart(quantity)} | onClick={() => addProductToCart(quantity)} |
| import { Button, Grid, Typography } from '@mui/material'; | |||||
| import { Button, Typography } from '@mui/material'; | |||||
| import { Box } from '@mui/system'; | import { Box } from '@mui/system'; | ||||
| import { useRouter } from 'next/router'; | import { useRouter } from 'next/router'; | ||||
| import { destroyCookie } from 'nookies'; | import { destroyCookie } from 'nookies'; | ||||
| } | } | ||||
| }, []); | }, []); | ||||
| return ( | return ( | ||||
| <Grid container spacing={2} sx={{ py: 10, height: '100%', width: '100%' }}> | |||||
| <Box sx={{ py: 10, height: '100%', width: '100%' }}> | |||||
| <StepTitle | <StepTitle | ||||
| title="Review" | title="Review" | ||||
| breadcrumbsArray={['Cart', 'Checkout', 'Shipping', 'Payment', 'Review']} | breadcrumbsArray={['Cart', 'Checkout', 'Shipping', 'Payment', 'Review']} | ||||
| /> | /> | ||||
| <Grid item xs={12} sx={{ mt: 1 }}> | |||||
| <Typography | |||||
| sx={{ | |||||
| width: '100%', | |||||
| textAlign: 'center', | |||||
| color: 'primary.main', | |||||
| fontWeight: 600, | |||||
| fontSize: 22, | |||||
| }} | |||||
| > | |||||
| ORDER COMPLETE SUCCESSFULLY | |||||
| </Typography> | |||||
| </Grid> | |||||
| <Grid item xs={12} sx={{ mt: 1 }}> | |||||
| <Typography | |||||
| sx={{ | |||||
| width: '100%', | |||||
| fontWeight: 600, | |||||
| mt: 2, | |||||
| textAlign: 'center', | |||||
| }} | |||||
| > | |||||
| Thank you for placing your order with us. We wll get to work on | |||||
| sending your order as soon as possible | |||||
| </Typography> | |||||
| </Grid> | |||||
| <Grid item xs={12} sx={{ mt: 1 }}> | |||||
| <Typography | |||||
| sx={{ | |||||
| width: '100%', | |||||
| textAlign: 'center', | |||||
| mt: 2, | |||||
| fontSize: 44, | |||||
| fontWeight: 600, | |||||
| }} | |||||
| > | |||||
| Order Summary | |||||
| </Typography> | |||||
| </Grid> | |||||
| <Grid item xs={12}> | |||||
| <Box sx={{ ml: { xs: 2 }, mr: { xs: 2 }, mt: 6 }}> | |||||
| <Box> | |||||
| <Typography | |||||
| sx={{ | |||||
| width: '100%', | |||||
| textAlign: 'center', | |||||
| color: 'primary.main', | |||||
| fontWeight: 600, | |||||
| fontSize: 22, | |||||
| }} | |||||
| > | |||||
| ORDER COMPLETE SUCCESSFULLY | |||||
| </Typography> | |||||
| </Box> | |||||
| <Box sx={{ mt: 1 }}> | |||||
| <Typography | |||||
| sx={{ | |||||
| width: '100%', | |||||
| fontWeight: 600, | |||||
| mt: 2, | |||||
| textAlign: 'center', | |||||
| }} | |||||
| > | |||||
| Thank you for placing your order with us. We wll get to work on | |||||
| sending your order as soon as possible | |||||
| </Typography> | |||||
| </Box> | |||||
| <Box sx={{ mt: 1 }}> | |||||
| <Typography | |||||
| sx={{ | |||||
| width: '100%', | |||||
| textAlign: 'center', | |||||
| mt: 4, | |||||
| mb: 4, | |||||
| fontSize: 44, | |||||
| fontWeight: 600, | |||||
| }} | |||||
| > | |||||
| Order Summary | |||||
| </Typography> | |||||
| </Box> | |||||
| <Box | <Box | ||||
| sx={{ | sx={{ | ||||
| backgroundColor: '#f2f2f2', | backgroundColor: '#f2f2f2', | ||||
| mt: 4, | |||||
| ml: 12, | |||||
| width: '85%', | |||||
| my: 1, | |||||
| ml: { md: 12 }, | |||||
| mr: { md: 12 }, | |||||
| borderRadius: 2, | borderRadius: 2, | ||||
| p: 1, | |||||
| p: 2, | |||||
| }} | }} | ||||
| > | > | ||||
| <Typography sx={{ fontSize: 18, fontWeight: 600 }}> | <Typography sx={{ fontSize: 18, fontWeight: 600 }}> | ||||
| Order placed on: {orderData.time} | Order placed on: {orderData.time} | ||||
| </Typography> | </Typography> | ||||
| </Box> | </Box> | ||||
| </Grid> | |||||
| <Grid item xs={12}> | |||||
| <Box | <Box | ||||
| sx={{ | sx={{ | ||||
| backgroundColor: '#f2f2f2', | backgroundColor: '#f2f2f2', | ||||
| ml: 12, | |||||
| width: '85%', | |||||
| ml: { md: 12 }, | |||||
| mr: { md: 12 }, | |||||
| borderRadius: 2, | borderRadius: 2, | ||||
| p: 1, | |||||
| p: 2, | |||||
| my: 1, | |||||
| }} | }} | ||||
| > | > | ||||
| <Typography sx={{ fontSize: 18, fontWeight: 600 }}> | <Typography sx={{ fontSize: 18, fontWeight: 600 }}> | ||||
| Email: {orderData?.shippingAddress?.email} | Email: {orderData?.shippingAddress?.email} | ||||
| </Typography> | </Typography> | ||||
| </Box> | </Box> | ||||
| </Grid> | |||||
| <Grid item xs={12}> | |||||
| <Box | <Box | ||||
| sx={{ | sx={{ | ||||
| backgroundColor: '#f2f2f2', | backgroundColor: '#f2f2f2', | ||||
| ml: 12, | |||||
| width: '85%', | |||||
| ml: { md: 12 }, | |||||
| mr: { md: 12 }, | |||||
| borderRadius: 2, | borderRadius: 2, | ||||
| p: 1, | |||||
| p: 2, | |||||
| my: 1, | |||||
| }} | }} | ||||
| > | > | ||||
| <Typography sx={{ fontSize: 18, fontWeight: 600 }}> | <Typography sx={{ fontSize: 18, fontWeight: 600 }}> | ||||
| Total: ${orderData?.totalPrice.toFixed(2)} | |||||
| Total: ${orderData?.totalPrice} | |||||
| </Typography> | </Typography> | ||||
| </Box> | </Box> | ||||
| </Grid> | |||||
| <Grid item xs={12}> | |||||
| <Box | <Box | ||||
| sx={{ | sx={{ | ||||
| backgroundColor: '#f2f2f2', | backgroundColor: '#f2f2f2', | ||||
| ml: 12, | |||||
| width: '85%', | |||||
| ml: { md: 12 }, | |||||
| mr: { md: 12 }, | |||||
| borderRadius: 2, | borderRadius: 2, | ||||
| p: 1, | |||||
| p: 2, | |||||
| my: 1, | |||||
| }} | }} | ||||
| > | > | ||||
| <Typography sx={{ fontSize: 18, fontWeight: 600 }}> | <Typography sx={{ fontSize: 18, fontWeight: 600 }}> | ||||
| {orderData?.shippingAddress?.postcode} | {orderData?.shippingAddress?.postcode} | ||||
| </Typography> | </Typography> | ||||
| </Box> | </Box> | ||||
| </Grid> | |||||
| <Grid item xs={12} sx={{ mt: 1 }}> | |||||
| <Box | |||||
| sx={{ | |||||
| width: '100%', | |||||
| display: 'flex', | |||||
| justifyContent: 'center', | |||||
| mt: 2, | |||||
| borderRadius: 2, | |||||
| p: 1, | |||||
| }} | |||||
| > | |||||
| <Button | |||||
| variant="contained" | |||||
| <Box sx={{ mt: 1 }}> | |||||
| <Box | |||||
| sx={{ | sx={{ | ||||
| mt: 3, | |||||
| mb: 2, | |||||
| height: 50, | |||||
| width: 150, | |||||
| textTransform: 'none', | |||||
| backgroundColor: '#CBA213', | |||||
| color: 'white', | |||||
| mr: 2, | |||||
| fontSize: 16, | |||||
| }} | |||||
| onClick={() => { | |||||
| router.push('/'); | |||||
| width: '100%', | |||||
| display: 'flex', | |||||
| justifyContent: 'center', | |||||
| mt: 2, | |||||
| borderRadius: 2, | |||||
| p: 1, | |||||
| }} | }} | ||||
| > | > | ||||
| Back to Home | |||||
| </Button> | |||||
| <Button | |||||
| variant="contained" | |||||
| sx={{ | |||||
| mt: 3, | |||||
| mb: 2, | |||||
| height: 50, | |||||
| width: 150, | |||||
| textTransform: 'none', | |||||
| backgroundColor: '#CBA213', | |||||
| color: 'white', | |||||
| mr: 2, | |||||
| fontSize: 16, | |||||
| }} | |||||
| onClick={() => { | |||||
| router.push('/'); | |||||
| }} | |||||
| > | |||||
| Back to Home | |||||
| </Button> | |||||
| </Box> | |||||
| </Box> | </Box> | ||||
| </Grid> | |||||
| </Grid> | |||||
| </Box> | |||||
| </Box> | |||||
| ); | ); | ||||
| }; | }; | ||||
| import { Checkbox, FormControlLabel, Grid, Typography } from '@mui/material'; | |||||
| import { Checkbox, FormControlLabel, Typography } from '@mui/material'; | |||||
| import { Box } from '@mui/system'; | import { Box } from '@mui/system'; | ||||
| import { useRouter } from 'next/router'; | import { useRouter } from 'next/router'; | ||||
| import { setCookie } from 'nookies'; | import { setCookie } from 'nookies'; | ||||
| }; | }; | ||||
| return ( | return ( | ||||
| <Grid container spacing={2} sx={{ py: 10, height: '100%', width: '100%' }}> | |||||
| <Box container spacing={2} sx={{ py: 10, height: '100%', width: '100%' }}> | |||||
| <StepTitle | <StepTitle | ||||
| title="Shipping" | title="Shipping" | ||||
| breadcrumbsArray={['Cart', 'Checkout', 'Shipping']} | breadcrumbsArray={['Cart', 'Checkout', 'Shipping']} | ||||
| /> | /> | ||||
| <Grid item xs={12} sx={{ mt: 1 }}> | |||||
| <Typography sx={{ pl: 12, fontSize: 20 }}> | |||||
| <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 | The following fields will be used as the shipping details for your | ||||
| order | order | ||||
| </Typography> | </Typography> | ||||
| </Grid> | |||||
| <Grid item xs={12} lg={8}> | |||||
| <ShippingData | |||||
| email={checkoutStorage?.userInfo?.email} | |||||
| address={checkoutStorage?.userInfo?.address} | |||||
| city={checkoutStorage?.userInfo?.city} | |||||
| postcode={checkoutStorage?.userInfo?.postcode} | |||||
| handleOpen={handleOpen} | |||||
| /> | |||||
| <Box | |||||
| sx={{ | |||||
| display: 'flex', | |||||
| justifyContent: 'space-between', | |||||
| backgroundColor: '#f2f2f2', | |||||
| alignItems: 'center', | |||||
| ml: 12, | |||||
| mb: 2, | |||||
| width: '30%', | |||||
| borderRadius: 2, | |||||
| p: 1, | |||||
| }} | |||||
| > | |||||
| <FormControlLabel | |||||
| control={<Checkbox checked disabled />} | |||||
| label="Free Shipping" | |||||
| sx={{ color: 'black', ml: 2 }} | |||||
| </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 } }}> | |||||
| <ShippingData | |||||
| email={checkoutStorage?.userInfo?.email} | |||||
| address={checkoutStorage?.userInfo?.address} | |||||
| city={checkoutStorage?.userInfo?.city} | |||||
| postcode={checkoutStorage?.userInfo?.postcode} | |||||
| handleOpen={handleOpen} | |||||
| /> | |||||
| <Box | |||||
| sx={{ | |||||
| display: 'flex', | |||||
| justifyContent: 'space-between', | |||||
| backgroundColor: '#f2f2f2', | |||||
| alignItems: 'center', | |||||
| mb: 2, | |||||
| width: { sm: '200px' }, | |||||
| borderRadius: 2, | |||||
| p: 1, | |||||
| }} | |||||
| > | |||||
| <FormControlLabel | |||||
| control={<Checkbox checked disabled />} | |||||
| label="Free Shipping" | |||||
| sx={{ color: 'black', ml: 2 }} | |||||
| /> | |||||
| </Box> | |||||
| <ButtonGroup | |||||
| handleStripePayment={handleStripePayment} | |||||
| handleBackToCart={handleBackToCart} | |||||
| /> | /> | ||||
| </Box> | </Box> | ||||
| <ButtonGroup | |||||
| handleStripePayment={handleStripePayment} | |||||
| handleBackToCart={handleBackToCart} | |||||
| /> | |||||
| </Grid> | |||||
| <Grid item xs={12} lg={4}> | |||||
| <Box | <Box | ||||
| sx={{ | 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' }, | |||||
| 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()} | {mapProductsToDom()} | ||||
| </Box> | </Box> | ||||
| </Grid> | |||||
| </Box> | |||||
| <ShippingModal | <ShippingModal | ||||
| open={open} | open={open} | ||||
| handleClose={handleClose} | handleClose={handleClose} | ||||
| handleChangeShipping={handleChangeShipping} | handleChangeShipping={handleChangeShipping} | ||||
| handleChangeContact={handleChangeContact} | handleChangeContact={handleChangeContact} | ||||
| /> | /> | ||||
| </Grid> | |||||
| </Box> | |||||
| ); | ); | ||||
| }; | }; | ||||
| <Box | <Box | ||||
| sx={{ | sx={{ | ||||
| display: 'flex', | display: 'flex', | ||||
| ml: 12, | |||||
| mb: 2, | mb: 2, | ||||
| borderRadius: 2, | borderRadius: 2, | ||||
| p: 1, | |||||
| }} | }} | ||||
| > | > | ||||
| <Button | <Button |
| backgroundColor: '#f2f2f2', | backgroundColor: '#f2f2f2', | ||||
| alignItems: 'center', | alignItems: 'center', | ||||
| mt: 2, | mt: 2, | ||||
| ml: 12, | |||||
| mb: 2, | mb: 2, | ||||
| borderRadius: 2, | borderRadius: 2, | ||||
| p: 1, | p: 1, | ||||
| justifyContent: 'space-between', | justifyContent: 'space-between', | ||||
| backgroundColor: '#f2f2f2', | backgroundColor: '#f2f2f2', | ||||
| alignItems: 'center', | alignItems: 'center', | ||||
| ml: 12, | |||||
| mb: 2, | mb: 2, | ||||
| borderRadius: 2, | borderRadius: 2, | ||||
| p: 1, | p: 1, |
| > | > | ||||
| <Box | <Box | ||||
| sx={{ | sx={{ | ||||
| width: '50%', | |||||
| width: { xs: '90%', md: '50%' }, | |||||
| top: '50%', | top: '50%', | ||||
| left: '50%', | left: '50%', | ||||
| position: 'absolute', | position: 'absolute', |
| const Products = () => { | const Products = () => { | ||||
| const [filter, setFilter] = useState(''); | const [filter, setFilter] = useState(''); | ||||
| const [sort, setSort] = useState(''); | const [sort, setSort] = useState(''); | ||||
| const { data, isLoading, fetchNextPage, hasNextPage } = useInfiniteProducts( | |||||
| filter, | |||||
| sort | |||||
| ); | |||||
| const { data, isLoading, fetchNextPage, hasNextPage, isFetchingNextPage } = | |||||
| useInfiniteProducts(filter, sort); | |||||
| const handleProductTypeChange = (event) => { | const handleProductTypeChange = (event) => { | ||||
| const filterText = event.target.value; | const filterText = event.target.value; | ||||
| productType={filter} | productType={filter} | ||||
| fetchNextPage={fetchNextPage} | fetchNextPage={fetchNextPage} | ||||
| hasNextPage={hasNextPage} | hasNextPage={hasNextPage} | ||||
| isFetchingNextPage={isFetchingNextPage} | |||||
| /> | /> | ||||
| )} | )} | ||||
| </Box> | </Box> |