PostCard.jsx 889 B

123456789101112131415161718192021222324252627282930313233343536
  1. import photoNotFound from '../materials/photoNotFound.png'
  2. import { Link } from 'react-router-dom'
  3. export const Card = ({ post }) => (
  4. <>
  5. <Link key={post?._id} to={`/post/${post?._id}`}>
  6. {post?.images && post?.images[0] && post.images[0]?.url ? (
  7. <div className='Wrapper'>
  8. <img
  9. className="Card"
  10. src={'/' + post.images[0].url}
  11. style={{
  12. width: '250px',
  13. height: '250px',
  14. objectFit: 'cover',
  15. }}
  16. />
  17. </div>
  18. ) : (
  19. <div className='Wrapper'>
  20. <img
  21. className="Card"
  22. src={photoNotFound}
  23. style={{
  24. width: '250px',
  25. height: '250px',
  26. objectFit: 'cover',
  27. }}
  28. />
  29. </div>
  30. )
  31. }
  32. </Link>
  33. </>
  34. )