diff --git a/src/app/browse/page.tsx b/src/app/browse/page.tsx index 8ede02d..ef89f38 100644 --- a/src/app/browse/page.tsx +++ b/src/app/browse/page.tsx @@ -1,39 +1,8 @@ -'use client'; +"use client"; -import { useState, useMemo } from 'react'; -import { ThemeProvider } from '@/components/theme/ThemeProvider'; -import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered'; - -const CARS_DATABASE = [ - { id: '1', brand: 'Toyota', name: 'Camry', year: 2023, price: '$28,500', type: 'Sedan', image: '/car-1.jpg' }, - { id: '2', brand: 'Toyota', name: 'Corolla', year: 2023, price: '$22,000', type: 'Sedan', image: '/car-2.jpg' }, - { id: '3', brand: 'Honda', name: 'Civic', year: 2023, price: '$24,000', type: 'Sedan', image: '/car-3.jpg' }, - { id: '4', brand: 'Honda', name: 'CR-V', year: 2023, price: '$32,000', type: 'SUV', image: '/car-4.jpg' }, - { id: '5', brand: 'Ford', name: 'Mustang', year: 2023, price: '$40,000', type: 'Sports', image: '/car-5.jpg' }, - { id: '6', brand: 'Ford', name: 'F-150', year: 2023, price: '$52,000', type: 'Truck', image: '/car-6.jpg' }, - { id: '7', brand: 'BMW', name: '3 Series', year: 2023, price: '$45,000', type: 'Sedan', image: '/car-7.jpg' }, - { id: '8', brand: 'Mercedes-Benz', name: 'C-Class', year: 2023, price: '$48,000', type: 'Sedan', image: '/car-8.jpg' }, -]; - -const YEARS = [2023, 2022, 2021, 2020]; -const TYPES = ['Sedan', 'SUV', 'Sports', 'Truck', 'Hatchback']; - -export default function BrowsePage() { - const [selectedBrand, setSelectedBrand] = useState(null); - const [selectedYear, setSelectedYear] = useState(null); - const [selectedType, setSelectedType] = useState(null); - - const brands = useMemo(() => [...new Set(CARS_DATABASE.map((car) => car.brand))], []); - - const filteredCars = useMemo(() => { - return CARS_DATABASE.filter((car) => { - if (selectedBrand && car.brand !== selectedBrand) return false; - if (selectedYear && car.year !== selectedYear) return false; - if (selectedType && car.type !== selectedType) return false; - return true; - }); - }, [selectedBrand, selectedYear, selectedType]); +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +const BrowsePage = () => { return ( - - -
-
-

Browse Cars

- - {/* Filters */} -
- {/* Brand Filter */} -
-

Filter by Brand

-
- - {brands.map((brand) => ( - - ))} -
-
- - {/* Year Filter */} -
-

Filter by Year

-
- - {YEARS.map((year) => ( - - ))} -
-
- - {/* Type Filter */} -
-

Filter by Type

-
- - {TYPES.map((type) => ( - - ))} -
-
-
- - {/* Cars Grid */} -
- {filteredCars.length > 0 ? ( - filteredCars.map((car) => ( -
-
- Car Image -
-
-
-
-

{car.brand}

-

{car.name}

-
- {car.type} -
-
-
-

Year

-

{car.year}

-
-
-

Starting Price

-

{car.price}

-
-
- -
-
- )) - ) : ( -
-

No cars found matching your filters

-
- )} -
-
-
+