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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { Button, Card, Divider, Typography } from '@mui/material';
  2. import { Box } from '@mui/system';
  3. import { useTranslation } from 'next-i18next';
  4. import Image from 'next/image';
  5. import { useRouter } from 'next/router';
  6. import { setCookie } from 'nookies';
  7. import PropType from 'prop-types';
  8. const OrderSummaryCard = ({ data }) => {
  9. const { t } = useTranslation('cart');
  10. const router = useRouter();
  11. return (
  12. <Card sx={{ p: 3, width: '100%', mb: 2, backgroundColor: '#f1f1f1' }}>
  13. <Typography
  14. sx={{
  15. fontSize: 26,
  16. color: 'primary.main',
  17. textAlign: 'center',
  18. width: '100%',
  19. }}
  20. >
  21. {t('cart:orderTitle')}
  22. </Typography>
  23. <Typography sx={{ mt: 4 }}>
  24. {t('cart:itemsTotal')}
  25. {data.totalPrice.toFixed(2)}
  26. </Typography>
  27. <Typography sx={{ mt: 1.5 }}>{t('cart:shipping')}</Typography>
  28. <Typography sx={{ mt: 1.5, mb: 1.5 }}>
  29. {t('cart:total')}
  30. {data.totalPrice.toFixed(2)}
  31. </Typography>
  32. <Divider />
  33. <Box sx={{ textAlign: 'center', mt: 4, width: '100%' }}>
  34. <Button
  35. disableRipple
  36. sx={{
  37. '&.Mui-disabled': {
  38. backgroundColor: '#0066ff',
  39. color: '#fff',
  40. opacity: '0.6',
  41. },
  42. '&:hover': {
  43. backgroundColor: '#0066ff',
  44. color: 'white',
  45. boxShadow: 'none',
  46. },
  47. backgroundColor: '#0066ff',
  48. color: 'white',
  49. textTransform: 'none',
  50. px: 2,
  51. }}
  52. startIcon={
  53. <Image src="/images/lock.svg" alt="lock" width={18} height={18} />
  54. }
  55. disabled={data.totalQuantity > 0 ? false : true}
  56. onClick={() => {
  57. router.push('/checkout');
  58. setCookie(null, 'checkout-session', 'active', {
  59. maxAge: 3600,
  60. expires: new Date(Date.now() + 3600),
  61. path: '/',
  62. });
  63. }}
  64. >
  65. {t('cart:proceed')}
  66. </Button>
  67. </Box>
  68. <Typography sx={{ mt: 3, fontSize: 13 }}>{t('cart:infoMsg')}</Typography>
  69. </Card>
  70. );
  71. };
  72. OrderSummaryCard.propTypes = {
  73. data: PropType.shape({
  74. totalPrice: PropType.number,
  75. totalQuantity: PropType.number,
  76. }),
  77. };
  78. export default OrderSummaryCard;