ItemFound.jsx 2.6 KB

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