ItemFound.jsx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import Link from "react-router-dom/es/Link";
  2. import {Box, Typography} from "@mui/material";
  3. import {backURL} from "../../actions/PathDB";
  4. import imgNotFound from "../../img/catalog/imgNotFound.png";
  5. export const ItemFound = ({item:{_id, name, price, images, description}}) => {
  6. return (
  7. <Link
  8. style={{
  9. textDecoration: 'none',
  10. display: 'flex',
  11. alignItems: 'center',
  12. marginBottom: '30px'
  13. }}
  14. to={`/good/${_id}`}
  15. >
  16. <Box
  17. width='60px'
  18. height='60px'
  19. borderRadius='10px'
  20. overflow='hidden'
  21. marginRight='60px'
  22. position='relative'
  23. >
  24. <img
  25. style={{
  26. position: 'absolute',
  27. top: '0',
  28. left: '0',
  29. width: '100%',
  30. height: '100%',
  31. objectFit: 'cover'
  32. }}
  33. src={Array.isArray(images) && images[0]?.url ? backURL + '/' + images[0]?.url : imgNotFound}
  34. alt={name}
  35. />
  36. </Box>
  37. <Box
  38. sx={{
  39. display: 'flex',
  40. flexDirection:'column',
  41. justifyContent: 'space-between',
  42. alignItems:'flex-start'
  43. }}
  44. >
  45. <Typography
  46. color='#000'
  47. letterSpacing='1px'
  48. fontFamily='sarif'
  49. fontWeight='600'
  50. variant='h6'
  51. >
  52. {name || 'name'}
  53. </Typography>
  54. <Typography
  55. letterSpacing='1px'
  56. variant='body1'
  57. fontWeight='300'
  58. color='#616161'
  59. margin='10px 0'
  60. >
  61. {
  62. description.length > 60 ?
  63. 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.'
  64. : description
  65. }
  66. </Typography>
  67. <Typography
  68. color='#000'
  69. letterSpacing='1px'
  70. variant='body1'
  71. fontWeight='600'
  72. >
  73. ${parseFloat(price || 0).toFixed(2)}
  74. </Typography>
  75. </Box>
  76. </Link>
  77. )
  78. }