import { Link } from "react-router-dom";

function ProductCard({ product, onAddToCart }) {
  return (
    <article className="product-card">
      <img src={product.image} alt={product.title} loading="lazy" />
      <h3>{product.title}</h3>
      <p className="category">{product.category}</p>
      <p className="price">{product.price.toFixed(2)} USD</p>
      <div className="card-actions">
        <button onClick={() => onAddToCart(product)}>Kosarba</button>
        <Link to={`/termekek/${product.id}`}>Reszletek</Link>
      </div>
    </article>
  );
}

export default ProductCard;
