import Link from 'next/link'; import ProductMockup from './ProductMockup'; import Price from './Price'; import type { ProductDTO } from '@/lib/types'; const NEW_WINDOW_MS = 1000 * 60 * 60 * 24 * 30; // 30 days export default function ProductCard({ product, hrefBase = '/made-to-order', }: { product: ProductDTO; hrefBase?: string; }) { const thumbnail = product.colorPhotos[product.colors[0]] ?? product.imageUrl; const isNew = Date.now() - new Date(product.createdAt).getTime() < NEW_WINDOW_MS; return ( {/* Image Container - Top 2/3 */}
{thumbnail ? ( {product.name} ) : (
)}
{/* Badges */}
{isNew && ( New )} {product.onSale && ( Sale )}
{/* Info Container - Bottom 1/3 */}

{product.name}

{/* Price */}
{product.onSale && product.originalPrice != null && ( )}
{/* CTA */}
Explore →
); }