Skip to content

Commit 4076627

Browse files
committed
add ProductCard component with image, badge and quick add
1 parent 83e64be commit 4076627

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React from 'react';
2+
import { Heart, TrendingUp } from 'lucide-react';
3+
import { motion } from 'framer-motion';
4+
5+
const ProductCard = ({ product, onClick }) => {
6+
return (
7+
<motion.div
8+
className="product-card"
9+
onClick={() => onClick(product)}
10+
initial={{ opacity: 0, y: 20 }}
11+
whileInView={{ opacity: 1, y: 0 }}
12+
viewport={{ once: true }}
13+
whileHover={{ y: -5 }}
14+
>
15+
<div className="card-image-wrap">
16+
<img src={product.image} alt={product.name} loading="lazy" />
17+
18+
{product.isTrending && (
19+
<div className="badge-trending">
20+
<TrendingUp size={14} />
21+
<span>Trending</span>
22+
</div>
23+
)}
24+
25+
<button className="wishlist-overlay" aria-label="Add to wishlist">
26+
<Heart size={20} />
27+
</button>
28+
29+
<div className="quick-add">
30+
<button>QUICK ADD</button>
31+
</div>
32+
</div>
33+
34+
<div className="card-info">
35+
<div className="brand">{product.brand}</div>
36+
<h3 className="name">{product.name}</h3>
37+
<p className="category">{product.category}</p>
38+
<div className="price">{product.price}</div>
39+
</div>
40+
41+
</motion.div>
42+
);
43+
};
44+
45+
export default ProductCard;

0 commit comments

Comments
 (0)