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.2KB

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