Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

DataCard.tsx 1.8KB

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