import React from 'react'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { Loader } from '@/app/components/ui/loader'; import RemixIcon from '@/components/ui/remix-icon'; interface ProductPrice { amount: string; currencyCode: string; } interface ProductVariant { id: string; title: string; price: ProductPrice; availableForSale: boolean; selectedOptions: Array<{ name: string; value: string; }>; } interface ProductOption { id: string; name: string; values: string[]; } interface Product { id: string; title: string; description?: string; descriptionHtml?: string; handle: string; priceRange: { minVariantPrice: ProductPrice; }; compareAtPriceRange?: { minVariantPrice: ProductPrice; }; options: ProductOption[]; } export interface ProductFeature { icon: string; label: string; } interface ProductDetailInfoProps { product: Product; selectedVariant: ProductVariant | null; selectedOptions: Record; quantity: number; setQuantity: (quantity: number) => void; handleAddToCart: () => void; onOptionChange: (optionName: string, value: string) => void; loading?: boolean; addToCartLabel?: string; features?: ProductFeature[]; } const ProductDetailInfo: React.FC = ({ product, selectedVariant, selectedOptions, quantity, setQuantity, handleAddToCart, onOptionChange, loading = false, addToCartLabel = 'Add to Cart', features = [ { icon: 'RiTruckLine', label: 'Free shipping on orders over $100' }, { icon: 'RiArrowGoBackLine', label: '30-day return policy' }, { icon: 'RiSecurePaymentLine', label: 'Secure payment' }, ], }) => { const formatPrice = (amount: string) => { return `$${parseFloat(amount).toFixed(2)}`; }; const price = selectedVariant?.price || product.priceRange.minVariantPrice; const compareAtPrice = product.compareAtPriceRange?.minVariantPrice; const hasDiscount = compareAtPrice && parseFloat(compareAtPrice.amount) > parseFloat(price.amount); return (
LUMINA COLLECTION

{product.title}

{/* Price */}
{formatPrice(price.amount)} {hasDiscount && compareAtPrice && ( <> {formatPrice(compareAtPrice.amount)} SAVE{' '} {Math.round( ((parseFloat(compareAtPrice.amount) - parseFloat(price.amount)) / parseFloat(compareAtPrice.amount)) * 100 )} % )}
{/* Description */} {product.description && (
{product.descriptionHtml ? (
) : (

{product.description}

)}
)} {/* Product Options */} {product.options && product.options.map((option) => (
{option.name}
{option.values.map((value) => ( ))}
))} {/* Quantity Selector */}
QUANTITY
{quantity}
{/* Add to Cart Button */} {/* Features */} {features.length > 0 && (
{features.map((feature, index) => (
{feature.label}
))}
)}
FREE SHIPPING • EASY RETURNS • SECURE CHECKOUT
); }; export default ProductDetailInfo;