Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import { Button, Divider, Paper, Typography } from '@mui/material';
  2. import { Box } from '@mui/system';
  3. import Image from 'next/image';
  4. import { useRouter } from 'next/router';
  5. import { setCookie } from 'nookies';
  6. import PropType from 'prop-types';
  7. const OrderSummaryCard = ({ data }) => {
  8. const router = useRouter();
  9. return (
  10. <Paper
  11. sx={{ p: 3, width: '100%', mb: 2, backgroundColor: '#f1f1f1' }}
  12. elevation={3}
  13. >
  14. <Typography
  15. sx={{
  16. fontSize: 26,
  17. color: 'primary.main',
  18. textAlign: 'center',
  19. width: '100%',
  20. }}
  21. >
  22. Order Summary
  23. </Typography>
  24. <Typography sx={{ mt: 4 }}>Items total:${data.totalPrice}</Typography>
  25. <Typography sx={{ mt: 1.5 }}>Shipping Costs: FREE</Typography>
  26. <Typography sx={{ mt: 1.5, mb: 1.5 }}>
  27. Total: ${data.totalPrice}
  28. </Typography>
  29. <Divider />
  30. <Box sx={{ textAlign: 'center', mt: 4, width: '100%' }}>
  31. <Button
  32. sx={{
  33. backgroundColor: '#0066ff',
  34. color: 'white',
  35. textTransform: 'none',
  36. px: 2,
  37. }}
  38. startIcon={
  39. <Image src="/images/lock.svg" alt="lock" width={18} height={18} />
  40. }
  41. disabled={data.totalQuantity > 0 ? false : true}
  42. onClick={() => {
  43. router.push('/checkout');
  44. setCookie(null, 'checkout-session', 'active', {
  45. maxAge: 3600,
  46. expires: new Date(Date.now() + 3600),
  47. path: '/',
  48. });
  49. }}
  50. >
  51. Proceed to Checkout
  52. </Button>
  53. </Box>
  54. <Typography sx={{ mt: 3, fontSize: 13 }}>
  55. Once the checkout process begins you will have an hour to complete your
  56. checkout otherwise you will be returned back to the cart to start over.
  57. </Typography>
  58. </Paper>
  59. );
  60. };
  61. OrderSummaryCard.propTypes = {
  62. data: PropType.shape({
  63. totalPrice: PropType.number,
  64. totalQuantity: PropType.number,
  65. }),
  66. };
  67. export default OrderSummaryCard;