diff --git a/src/app/cars/[id]/page.tsx b/src/app/cars/[id]/page.tsx new file mode 100644 index 0000000..740c42c --- /dev/null +++ b/src/app/cars/[id]/page.tsx @@ -0,0 +1,273 @@ +"use client"; + +import { useParams } from "next/navigation"; +import { useState } from "react"; +import { ChevronLeft, ChevronRight, Heart, Share2, MapPin, Fuel, Gauge, Calendar } from "lucide-react"; + +interface CarDetail { + id: string; + name: string; + price: string; + rating: number; + description: string; + images: Array<{ src: string; alt: string }>; + specs: { + year: string; + mileage: string; + transmission: string; + fuelType: string; + engine: string; + color: string; + }; + features: string[]; + variants?: Array<{ + label: string; + options: string[]; + selected: string; + }>; +} + +const mockCarData: { [key: string]: CarDetail } = { + "1": { + id: "1", name: "2024 Tesla Model S", price: "$89,990", rating: 5, + description: "Experience the future of electric vehicles with cutting-edge technology and exceptional performance.", images: [ + { src: "https://images.unsplash.com/photo-1560958089-b8a63dd8b50b?w=800", alt: "Tesla Model S Front" }, + { src: "https://images.unsplash.com/photo-1516814050195-3a03d82e059d?w=800", alt: "Tesla Model S Side" }, + { src: "https://images.unsplash.com/photo-1552820728-8ac41f1ce891?w=800", alt: "Tesla Model S Interior" }, + ], + specs: { + year: "2024", mileage: "5,200 miles", transmission: "Automatic", fuelType: "Electric", engine: "Dual Motor", color: "Solid Black"}, + features: [ + "Autopilot Advanced", "Premium Audio System", "Panoramic Sunroof", "19-inch Wheel Set", "Premium Interior", "Over-the-Air Updates", "Supercharger Access", "Enhanced Autopilot"], + }, + "2": { + id: "2", name: "2024 BMW M440i xDrive", price: "$67,500", rating: 5, + description: "German engineering meets performance with the new M440i xDrive.", images: [ + { src: "https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=800", alt: "BMW M440i Front" }, + { src: "https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=800", alt: "BMW M440i Side" }, + { src: "https://images.unsplash.com/photo-1533473359331-35b3c3f0f038?w=800", alt: "BMW M440i Interior" }, + ], + specs: { + year: "2024", mileage: "8,100 miles", transmission: "Automatic", fuelType: "Gasoline", engine: "3.0L Twin-Turbo", color: "Alpine White"}, + features: [ + "M Sport Brake Package", "Premium Sound System", "Adaptive M Suspension", "20-inch M Light Alloy Wheels", "Harman Kardon Audio", "Gesture Control", "Head-Up Display", "Premium Leather Interior"], + }, +}; + +export default function CarDetailPage() { + const params = useParams(); + const carId = params.id as string; + const car = mockCarData[carId]; + const [currentImageIndex, setCurrentImageIndex] = useState(0); + const [isFavorited, setIsFavorited] = useState(false); + + if (!car) { + return ( +
{car.description}
+{car.specs.year}
+{car.specs.mileage}
+{car.specs.fuelType}
+{car.specs.transmission}
+