import React from 'react' const ProductCard = ({ product, onAddToCart }) => { const renderStars = (rating) => { const stars = [] const fullStars = Math.floor(rating) const hasHalfStar = rating % 1 !== 0 for (let i = 0; i < fullStars; i++) { stars.push() } if (hasHalfStar) { stars.push() } const emptyStars = 5 - Math.ceil(rating) for (let i = 0; i < emptyStars; i++) { stars.push() } return stars } return (
{product.title}
{product.title}

{product.description.substring(0, 100)}...

{renderStars(product.rating.rate)}
({product.rating.count})
${product.price}
) } export default ProductCard