Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

DataCard.tsx 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { Box, Card, Typography } from '@mui/material';
  2. import Image from 'next/image';
  3. const DataCard = ({ data, quantity }) => {
  4. return (
  5. <Card
  6. height="100%"
  7. sx={{
  8. backgroundColor: '#f2f2f2',
  9. mb: 2,
  10. p: 2,
  11. mx: { xs: 0, sm: 1 },
  12. width: { xs: '100%', sm: '44%', md: '100%', lg: '100%' },
  13. }}
  14. >
  15. <Box
  16. sx={{
  17. display: 'flex',
  18. flexDirection: { xs: 'column', lg: 'row' },
  19. }}
  20. >
  21. <Box sx={{ display: 'flex', justifyContent: 'center' }}>
  22. <Image src={data.image} alt="profile" width={200} height={200} />
  23. </Box>
  24. <Box
  25. sx={{
  26. width: '100%',
  27. display: 'flex',
  28. flexDirection: 'column',
  29. alignItems: 'center',
  30. justifyItems: 'center',
  31. }}
  32. >
  33. <Typography
  34. sx={{
  35. textAlign: 'center',
  36. fontWeight: 600,
  37. fontSize: { md: 20, xs: 16 },
  38. pt: { xs: 2 },
  39. }}
  40. >
  41. {data.name}
  42. </Typography>
  43. <Typography
  44. sx={{
  45. width: '100%',
  46. textAlign: 'center',
  47. fontWeight: 600,
  48. fontSize: { md: 20, xs: 16 },
  49. }}
  50. >
  51. x{quantity}
  52. </Typography>
  53. <Typography
  54. sx={{
  55. mt: { lg: 3, xs: 1 },
  56. textAlign: 'center',
  57. fontSize: 14,
  58. }}
  59. >
  60. ${data.price} (per unit)
  61. </Typography>
  62. </Box>
  63. </Box>
  64. </Card>
  65. );
  66. };
  67. export default DataCard;