11import React from "react" ;
2- import { Apple } from "lucide-react"
32import type { Product } from "../../../../store/product.store"
3+
44const ProductCard : React . FC < { product : Product } > = ( { product } ) => {
5+ const isComingSoon = product . status === 'coming-soon' ;
6+ const isOutOfStock = product . status === 'out-of-stock' ;
7+
8+ const handleBuyNow = ( ) => {
9+ if ( isComingSoon || isOutOfStock ) return ;
10+ const message = encodeURIComponent ( `Hi ZAYQ! I'm interested in the ${ product . name } (₹${ product . price } ). Is it in stock?` ) ;
11+ window . open ( `https://wa.me/91XXXXXXXXXX?text=${ message } ` , '_blank' ) ; // Replace with your WhatsApp number
12+ } ;
13+
514 return (
6- < div className = "flex flex-col group cursor-pointer" >
7- < div className = "relative aspect-4/5 rounded-3xl bg-[#E6E3DF] flex items-center justify-center overflow-hidden transition-all duration-700 ease-in-out group-hover:bg-[#EFECE8]" >
8- < div
9- className = "relative w-32 h-64 sm:w-40 sm:h-80 rounded-[2.8rem] shadow-2xl border-[6px] border-[#1C1C1C] flex flex-col items-center p-2 transition-transform duration-500 ease-out group-hover:scale-105"
10- style = { {
11- backgroundColor : product . colorHex ,
12- backgroundImage : product . type === 'clear' ? 'linear-gradient(135deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.1) 100%)' : 'none' ,
13- } }
14- >
15- < div className = "absolute top-5 left-5 w-14 h-14 bg-black/10 rounded-xl p-1.5 grid grid-cols-2 gap-1" >
16- < div className = "w-5 h-5 rounded-full bg-black/30" > </ div >
17- < div className = "w-5 h-5 rounded-full bg-black/30" > </ div >
18- < div className = "w-5 h-5 rounded-full bg-black/30 col-span-2 mx-auto" > </ div >
15+ < div className = "flex flex-col group" >
16+ { /* Image Wrapper */ }
17+ < div className = "relative aspect-4/5 rounded-2xl bg-[#E6E3DF] overflow-hidden transition-all duration-500 group-hover:bg-[#EFECE8]" >
18+
19+ { /* Status Badge */ }
20+ { ( isComingSoon || isOutOfStock ) && (
21+ < div className = "absolute top-4 left-4 z-20 px-3 py-1 bg-white/90 backdrop-blur-md rounded-full shadow-sm" >
22+ < p className = "text-[9px] font-black uppercase tracking-widest text-black" >
23+ { isComingSoon ? 'Coming Soon' : 'Sold Out' }
24+ </ p >
1925 </ div >
20- { product . type === 'clear' && < div className = "mt-32 opacity-10" > < Apple size = { 40 } /> </ div > }
26+ ) }
27+
28+ { /* Actual Product Image */ }
29+ < div className = { `w-full h-full transition-all duration-700 ease-in-out ${ ! isComingSoon && 'group-hover:scale-110' } ${ isComingSoon ? 'blur-xl opacity-50' : 'opacity-100' } ` } >
30+ { product . imageUrl ? (
31+ < img
32+ src = { product . imageUrl }
33+ alt = { product . name }
34+ className = "w-full h-full object-cover"
35+ />
36+ ) : (
37+ < div className = "w-full h-full flex items-center justify-center text-gray-400 text-xs" >
38+ No Image Available
39+ </ div >
40+ ) }
2141 </ div >
22- < div className = "absolute bottom-8 w-32 h-4 bg-black/5 blur-xl rounded-full opacity-0 group-hover:opacity-100 transition-opacity duration-500" > </ div >
42+
43+ { /* Hover Overlay for In-Stock items */ }
44+ { ! isComingSoon && ! isOutOfStock && (
45+ < div className = "absolute inset-0 bg-black/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300" />
46+ ) }
2347 </ div >
24- < div className = "mt-6 flex flex-col items-center text-center" >
25- < h3 className = "text-lg font-bold text-[#111111]" > { product . name } </ h3 >
26- < p className = "text-[#8F8F8F] text-sm font-medium" > { product . category } </ p >
27- < p className = "text-[#111111] font-semibold mt-1" > ₹{ product . price . toLocaleString ( ) } </ p >
28- < button className = "mt-5 w-full max-w-40 py-3 bg-[#111111] text-white text-[10px] font-bold uppercase tracking-[0.2em] rounded-full transition-all duration-300 hover:bg-[#2A2A2A] hover:scale-[1.02]" >
29- Add to Cart
48+
49+ { /* Details Section */ }
50+ < div className = "mt-5 flex flex-col items-center text-center" >
51+ < h3 className = "text-base font-bold text-[#111111] tracking-tight" > { product . name } </ h3 >
52+ < p className = "text-[#8F8F8F] text-xs font-medium uppercase tracking-wider mt-1" > { product . category } </ p >
53+ < p className = "text-[#111111] font-semibold mt-2" > ₹{ product . price . toLocaleString ( ) } </ p >
54+
55+ < button
56+ onClick = { handleBuyNow }
57+ disabled = { isComingSoon || isOutOfStock }
58+ className = { `mt-4 w-full py-3 text-[10px] font-bold uppercase tracking-[0.2em] rounded-xl transition-all duration-300
59+ ${ isComingSoon || isOutOfStock
60+ ? 'bg-gray-200 text-gray-400 cursor-not-allowed'
61+ : 'bg-[#111111] text-white hover:bg-black active:scale-95' } `}
62+ >
63+ { isComingSoon ? 'Coming Soon' : isOutOfStock ? 'Sold Out' : 'Order via WhatsApp' }
3064 </ button >
3165 </ div >
3266 </ div >
3367 ) ;
3468} ;
69+
3570export default ProductCard ;
0 commit comments