'use client'; import { useState, useEffect } from 'react'; import Image from 'next/image'; import Header from "@/components/Header"; import Footer from "@/components/Footer"; import { dataStore } from '@/lib/dataStore'; import type { MediaItem } from '@/data/media'; export default function MediaGallery() { const [mediaItems, setMediaItems] = useState([]); const [selectedTab, setSelectedTab] = useState<'all' | 'video' | 'photo'>('all'); const [selectedMedia, setSelectedMedia] = useState(null); useEffect(() => { setMediaItems(dataStore.getMedia()); }, []); const filteredMedia = selectedTab === 'all' ? mediaItems : mediaItems.filter(item => item.type === selectedTab); const selectedMediaItem = selectedMedia !== null ? mediaItems.find(item => item.id === selectedMedia) : null; return (
{/* Başlık */}

Medya Galerisi

A2 Metro Hattı projesi ile ilgili videolar ve fotoğraflar

{/* Tab Menü */}
{/* Medya Grid */} {!selectedMediaItem ? (
{filteredMedia.map((item) => (
setSelectedMedia(item.id)} className="bg-white rounded-xl overflow-hidden shadow-lg hover:shadow-2xl transition-all duration-300 hover:-translate-y-2 cursor-pointer group" > {/* Thumbnail */}
{item.title} {/* Video Badge */} {item.type === 'video' && (
)} {/* Duration Badge */} {item.type === 'video' && (
{item.duration}
)} {/* Photo Badge */} {item.type === 'photo' && (
FOTO
)}
{/* Content */}
{item.date}

{item.title}

{item.description}

))}
) : ( /* Medya Detayı */
{/* Geri Butonu */} {/* Video Player veya Büyük Fotoğraf */} {selectedMediaItem?.type === 'video' ? (
) : (
{selectedMediaItem?.title
)} {/* Bilgiler */}
{selectedMediaItem?.date} {selectedMediaItem?.type === 'video' && ( <> {selectedMediaItem?.duration} )}

{selectedMediaItem?.title}

{selectedMediaItem?.description}

{/* Paylaş */}
Paylaş:
)}
); }