Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

OrderSummaryCard.tsx 2.7KB

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