PostCard.js 767 B

123456789101112131415161718192021222324252627282930
  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. <img
  8. className="Card"
  9. src={'/' + post.images[0].url}
  10. style={{
  11. width: '250px',
  12. height: '250px',
  13. objectFit: 'cover',
  14. }}
  15. />
  16. ) : (
  17. <img
  18. className="Card"
  19. src={photoNotFound}
  20. style={{
  21. width: '250px',
  22. height: '250px',
  23. objectFit: 'cover',
  24. }}
  25. />
  26. )}
  27. </Link>
  28. </>
  29. )