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