You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DataCard.jsx 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import { Box, Paper, Typography } from '@mui/material';
  2. import Image from 'next/image';
  3. import PropType from 'prop-types';
  4. const DataCard = ({ data, quantity }) => {
  5. return (
  6. <Paper
  7. sx={{
  8. p: 3,
  9. width: { lg: '100%', xs: '35%' },
  10. mb: 2,
  11. ml: { lg: 0, xs: 6 },
  12. backgroundColor: '#f2f2f2',
  13. display: 'flex',
  14. flex: { xs: [0, 0, '32%'], lg: 'none' },
  15. }}
  16. elevation={3}
  17. >
  18. <Box
  19. sx={{
  20. width: '30%',
  21. display: { xs: 'none', lg: 'flex' },
  22. }}
  23. >
  24. <Image
  25. src="/images/coffee-mug.svg"
  26. alt="profile"
  27. width={200}
  28. height={250}
  29. />
  30. </Box>
  31. <Box
  32. sx={{
  33. ml: { xs: 0, md: 3 },
  34. display: 'flex',
  35. flexDirection: 'column',
  36. }}
  37. >
  38. <Typography
  39. sx={{
  40. width: '100%',
  41. textAlign: 'center',
  42. fontWeight: 600,
  43. fontSize: { md: 20, xs: 16 },
  44. }}
  45. >
  46. {data.name}
  47. </Typography>
  48. <Typography
  49. sx={{
  50. width: '100%',
  51. textAlign: 'center',
  52. fontWeight: 600,
  53. fontSize: { md: 20, xs: 16 },
  54. }}
  55. >
  56. x{quantity}
  57. </Typography>
  58. <Typography
  59. sx={{
  60. mt: { lg: 3, xs: 1 },
  61. textAlign: 'center',
  62. fontSize: 14,
  63. }}
  64. >
  65. ${data.price} (per unit)
  66. </Typography>
  67. </Box>
  68. </Paper>
  69. );
  70. };
  71. DataCard.propTypes = {
  72. product: PropType.shape({
  73. category: PropType.string,
  74. name: PropType.string,
  75. image: PropType.string,
  76. description: PropType.string,
  77. place: PropType.string,
  78. people: PropType.string,
  79. process: PropType.string,
  80. pairing: PropType.string,
  81. available: PropType.Boolean,
  82. isFeatured: PropType.Boolean,
  83. price: PropType.number,
  84. customID: PropType.string,
  85. }),
  86. quantity: PropType.number,
  87. };
  88. export default DataCard;