From 694eb10ee2c7be1404f384b4c6d16981b8a5df42 Mon Sep 17 00:00:00 2001 From: development Date: Wed, 4 Feb 2026 11:23:01 +0000 Subject: [PATCH] Add src/components/ProductCard.tsx --- src/components/ProductCard.tsx | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/components/ProductCard.tsx diff --git a/src/components/ProductCard.tsx b/src/components/ProductCard.tsx new file mode 100644 index 0000000..f84ab4a --- /dev/null +++ b/src/components/ProductCard.tsx @@ -0,0 +1,73 @@ +'use client'; + +import Image from 'next/image'; +import { Button } from '@/components/ui/button'; +import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; + +interface StripeProduct { + id: string; + name: string; + description: string | null; + images: string[]; + default_price: { + id: string; + unit_amount: number; + currency: string; + } | null; + metadata: Record; +} + +interface ProductCardProps { + product: StripeProduct; + onCheckout: (productId: string, priceId: string) => void; +} + +export default function ProductCard({ product, onCheckout }: ProductCardProps) { + const formatPrice = (amount: number, currency: string) => { + return new Intl.NumberFormat('en-US', { + style: 'currency', + currency: currency.toUpperCase(), + }).format(amount / 100); + }; + + return ( + + {product.images[0] && ( +
+ {product.name} +
+ )} + + {product.name} + {product.default_price && ( +

+ {formatPrice(product.default_price.unit_amount, product.default_price.currency)} +

+ )} +
+ + {product.description && ( + {product.description} + )} + + + + +
+ ); +}