From 8fc224dbfdf53ca358ba8534ea3d1a8f0ec0a522 Mon Sep 17 00:00:00 2001 From: bender Date: Thu, 12 Mar 2026 08:14:45 +0000 Subject: [PATCH] Update src/app/product/[id]/page.tsx --- src/app/product/[id]/page.tsx | 279 +++++++++++++++++----------------- 1 file changed, 140 insertions(+), 139 deletions(-) diff --git a/src/app/product/[id]/page.tsx b/src/app/product/[id]/page.tsx index 287d691..9e34927 100644 --- a/src/app/product/[id]/page.tsx +++ b/src/app/product/[id]/page.tsx @@ -20,30 +20,28 @@ const TikTok = (props: React.SVGProps) => ( ); -const products = [ - { - id: "1", name: "Classic Black Hoodie", price: 89.99, - description: "Premium oversized hoodie crafted from 100% organic cotton. Perfect for layering or wearing solo. Features reinforced seams and a comfortable fit that works with any style.", image: "http://img.b2bpic.net/free-photo/medium-shot-man-posing-with-hoodie-indoors_23-2149359859.jpg", sizes: ["XS", "S", "M", "L", "XL", "XXL"], +const products: Record = { + "1": { + id: "1", name: "Classic Black Hoodie", price: "$89.99", originalPrice: "$119.99", description: "Our signature black hoodie - a timeless essential for any streetwear collection. Premium 100% cotton blend with soft interior lining. Features a kangaroo pocket, drawstring with metal tips, and embroidered Umbra logo on the chest.", images: [ + "http://img.b2bpic.net/free-photo/medium-shot-man-posing-with-hoodie-indoors_23-2149359859.jpg", "http://img.b2bpic.net/free-photo/medium-shot-man-posing-with-hoodie-indoors_23-2149359859.jpg"], + sizes: ["XS", "S", "M", "L", "XL", "2XL"], colors: ["Black", "Charcoal", "Navy"], + rating: 4.8, + reviews: 342, + inStock: true, }, - { - id: "2", name: "Vintage Denim Jacket", price: 129.99, - description: "Timeless denim jacket with authentic vintage wash. Perfect for any occasion. Heavy-duty construction with durable hardware and reinforced stitching.", image: "http://img.b2bpic.net/free-photo/fashionable-woman-wearing-denim-jacket_23-2148859621.jpg", sizes: ["XS", "S", "M", "L", "XL"], - colors: ["Indigo", "Light Wash", "Medium Wash"], + "2": { + id: "2", name: "Vintage Denim Jacket", price: "$129.99", description: "Classic denim jacket with a vintage washed finish. Perfect layering piece for any outfit. Features button closure, flap pockets, and adjustable waist tabs.", images: [ + "http://img.b2bpic.net/free-photo/fashionable-woman-wearing-denim-jacket_23-2148859621.jpg"], + sizes: ["XS", "S", "M", "L", "XL", "2XL"], + colors: ["Indigo", "Light Wash", "Dark Wash"], + rating: 4.6, + reviews: 218, + inStock: true, }, - { - id: "3", name: "Cargo Pants - Khaki", price: 79.99, - description: "Versatile cargo pants with multiple pockets. Made from durable cotton blend. Perfect for everyday wear and outdoor adventures.", image: "http://img.b2bpic.net/free-photo/young-woman-wearing-trucker-hat_23-2149432334.jpg", sizes: ["28", "30", "32", "34", "36", "38"], - colors: ["Khaki", "Olive", "Black"], - }, -]; +}; export default function ProductPage({ params }: { params: { id: string } }) { - const product = products.find((p) => p.id === params.id); - const [quantity, setQuantity] = useState(1); - const [selectedSize, setSelectedSize] = useState(product?.sizes[0]); - const [selectedColor, setSelectedColor] = useState(product?.colors[0]); - const navItems = [ { name: "Shop", id: "products" }, { name: "Collections", id: "collections" }, @@ -52,6 +50,12 @@ export default function ProductPage({ params }: { params: { id: string } }) { { name: "Contact", id: "contact" }, ]; + const product = products[params.id] || products["1"]; + const [quantity, setQuantity] = useState(1); + const [selectedSize, setSelectedSize] = useState(product.sizes[2]); + const [selectedColor, setSelectedColor] = useState(product.colors[0]); + const [selectedImage, setSelectedImage] = useState(0); + const socialLinks = [ { icon: Instagram, href: "https://instagram.com/umbra", ariaLabel: "Instagram" }, { icon: Twitter, href: "https://twitter.com/umbra", ariaLabel: "Twitter" }, @@ -59,46 +63,6 @@ export default function ProductPage({ params }: { params: { id: string } }) { { icon: Youtube, href: "https://youtube.com/@umbra", ariaLabel: "YouTube" }, ]; - if (!product) { - return ( - - -
-
-

Product not found

- - Back to Shop - -
-
- -
- ); - } - return ( -
+
← Back to Shop -
-
- {product.name} +
+ {/* Product Images */} +
+
+ {product.name} +
+
+ {product.images.map((img: string, idx: number) => ( + + ))} +
-
-

{product.name}

-

- ${product.price.toFixed(2)} -

-

{product.description}

+ {/* Product Details */} +
+

{product.name}

-
-
- -
- {product.sizes.map((size) => ( - - ))} -
-
- -
- -
- {product.colors.map((color) => ( - - ))} -
-
- -
- -
- - {quantity} + ★ + + ))} +
+ ({product.reviews} reviews) +
+ +
+ {product.price} + {product.originalPrice && ( + {product.originalPrice} + )} +
+ +

{product.description}

+ + {/* Color Selection */} +
+ +
+ {product.colors.map((color: string) => ( -
+ ))}
-
- - + {/* Size Selection */} +
+ +
+ {product.sizes.map((size: string) => ( + + ))} +
-
-

- Free Shipping: On orders over $150 -

-

- Easy Returns: 30-day money-back guarantee -

+ {/* Quantity */} +
+ +
+ + {quantity} + +
+ + {/* Add to Cart Button */} + + + + + {/* Stock Status */} + {product.inStock ? ( +

✓ In Stock - Ships within 24 hours

+ ) : ( +

Out of Stock - Notify me when available

+ )}