diff --git a/app/filomuz/page.tsx b/app/filomuz/page.tsx index ab55217..ba5a399 100644 --- a/app/filomuz/page.tsx +++ b/app/filomuz/page.tsx @@ -4,9 +4,9 @@ import { FloatingWhatsApp } from "@/components/FloatingWhatsApp"; import { CTASection } from "@/components/CTASection"; import { LoadMeterSection } from "@/components/LoadMeterSection"; import Image from "next/image"; -import { cn } from "@/lib/utils"; import { Metadata } from "next"; import { FLEET_ITEMS } from "@/lib/data"; +import { FleetList } from "@/components/FleetList"; export const metadata: Metadata = { title: "Geniş Vinç Filosu ve İş Makineleri Parkurumuz", @@ -44,75 +44,7 @@ export default function FleetPage() { - {/* Filter System */} - - - - Filtrele: - {FLEET_CATEGORIES.map((category, index) => ( - - {category} - - ))} - - - - - {/* Fleet Grid */} - - - {FLEET_ITEMS.map((item, index) => ( - - - - - {item.status} - - - - - {item.name} - - - {item.description} - - - - Kapasite - {item.capacity} - - - Erişim - {item.reach} - - - - İncele - - - - ))} - - + diff --git a/components/FleetList.tsx b/components/FleetList.tsx new file mode 100644 index 0000000..22441de --- /dev/null +++ b/components/FleetList.tsx @@ -0,0 +1,103 @@ +'use client'; + +import { useState } from 'react'; +import Image from "next/image"; +import { cn } from "@/lib/utils"; + +interface FleetItem { + name: string; + description: string; + capacity: string; + reach: string; + image: string; + status: string; + category: string; +} + +interface FleetListProps { + items: FleetItem[]; + categories: string[]; +} + +export function FleetList({ items, categories }: FleetListProps) { + const [activeCategory, setActiveCategory] = useState("Hepsi"); + + const filteredItems = activeCategory === "Hepsi" + ? items + : items.filter(item => item.category === activeCategory); + + return ( + <> + {/* Filter System */} + + + + Filtrele: + {categories.map((category) => ( + setActiveCategory(category)} + className={cn( + "px-5 py-2 text-xs font-bold uppercase tracking-wider transition-all", + activeCategory === category + ? "bg-primary text-on-primary" + : "bg-surface-container-highest text-on-surface-variant hover:text-primary" + )} + > + {category} + + ))} + + + + + {/* Fleet Grid */} + + + {filteredItems.map((item, index) => ( + + + + + {item.status} + + + + + {item.name} + + + {item.description} + + + + Kapasite + {item.capacity} + + + Erişim + {item.reach} + + + + İncele + + + + ))} + + + > + ); +}
- {item.description} -
+ {item.description} +