diff --git a/src/app/product/[id]/page.tsx b/src/app/product/[id]/page.tsx index ee17b35..287d691 100644 --- a/src/app/product/[id]/page.tsx +++ b/src/app/product/[id]/page.tsx @@ -3,7 +3,7 @@ import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; import NavbarStyleCentered from "@/components/navbar/NavbarStyleCentered/NavbarStyleCentered"; import FooterCard from "@/components/sections/footer/FooterCard"; -import { Instagram, Twitter, Youtube, ShoppingCart, Heart } from "lucide-react"; +import { Instagram, Twitter, Youtube } from "lucide-react"; import Link from "next/link"; import { useState } from "react"; @@ -20,29 +20,29 @@ const TikTok = (props: React.SVGProps) => ( ); -const products: Record = { - "1": { +const products = [ + { id: "1", name: "Classic Black Hoodie", price: 89.99, - description: "Experience the epitome of urban comfort with our Classic Black Hoodie. Crafted from premium heavyweight cotton blend, this essential piece offers a perfect balance of style and warmth. The oversized silhouette provides that coveted streetwear aesthetic, while premium stitching ensures durability. Whether you're hitting the streets or relaxing at home, this hoodie becomes an instant wardrobe staple.", imageSrc: "http://img.b2bpic.net/free-photo/medium-shot-man-posing-with-hoodie-indoors_23-2149359859.jpg", imageAlt: "Classic black oversized hoodie", sizes: ["XS", "S", "M", "L", "XL", "2XL"], + 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"], colors: ["Black", "Charcoal", "Navy"], - rating: 4.8, - reviews: 124, }, - "2": { + { id: "2", name: "Vintage Denim Jacket", price: 129.99, - description: "Step back in time with our Vintage Denim Jacket, an iconic piece that never goes out of style. This carefully distressed jacket combines classic denim craftsmanship with modern streetwear edge. Perfect for layering, it adds instant cool factor to any outfit. The slightly faded wash and strategic rips create that perfect worn-in vintage feel that can only come from quality construction and timeless design.", imageSrc: "http://img.b2bpic.net/free-photo/fashionable-woman-wearing-denim-jacket_23-2148859621.jpg", imageAlt: "Vintage style denim jacket", sizes: ["XS", "S", "M", "L", "XL"], - colors: ["Indigo", "Light Wash", "Black Denim"], - rating: 4.9, - reviews: 89, + 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"], }, -}; + { + 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[params.id] || products["1"]; + const product = products.find((p) => p.id === params.id); const [quantity, setQuantity] = useState(1); - const [selectedSize, setSelectedSize] = useState(product.sizes[2]); - const [selectedColor, setSelectedColor] = useState(product.colors[0]); - const [isFavorited, setIsFavorited] = useState(false); + const [selectedSize, setSelectedSize] = useState(product?.sizes[0]); + const [selectedColor, setSelectedColor] = useState(product?.colors[0]); const navItems = [ { name: "Shop", id: "products" }, @@ -59,6 +59,46 @@ 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 Image */} -
+
{product.imageAlt}
- {/* Product Info */} -
-
-

{product.name}

-
-
- {[...Array(5)].map((_, i) => ( - +
+

{product.name}

+

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

+

{product.description}

+ +
+
+ +
+ {product.sizes.map((size) => ( + ))}
- {product.rating} ({product.reviews} reviews)
-

${product.price.toFixed(2)}

-
-

{product.description}

+
+ +
+ {product.colors.map((color) => ( + + ))} +
+
- {/* Size Selection */} -
- -
- {product.sizes.map((size: string) => ( +
+ +
- ))} -
-
- - {/* Color Selection */} -
- -
- {product.colors.map((color: string) => ( + {quantity} - ))} +
- {/* Quantity Selection */} -
- -
- - {quantity} - -
-
- - {/* Add to Cart & Favorite */} -
- -
- {/* Product Details */} -
-

✓ Free shipping on orders over $150

-

✓ 30-day return policy

-

✓ Secure checkout with multiple payment options

+
+

+ Free Shipping: On orders over $150 +

+

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