Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

OrderSummaryCard.jsx 1.8KB

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