'use client' import { useState } from 'react' import Image from 'next/image' import { Input } from "@/components/ui/input" import { Button } from "@/components/ui/button" import { ChevronLeft, ChevronRight } from 'lucide-react' import { useConfig } from '../hooks/useConfig' const ITEMS_PER_PAGE = 6 export default function Showcase() { const { config } = useConfig() const [currentPage, setCurrentPage] = useState(1) const [searchTerm, setSearchTerm] = useState('') const filteredShowcase = config.showcase.filter(photo => photo.title.toLowerCase().includes(searchTerm.toLowerCase()) || photo.author.toLowerCase().includes(searchTerm.toLowerCase()) ) const totalPages = Math.ceil(filteredShowcase.length / ITEMS_PER_PAGE) const startIndex = (currentPage - 1) * ITEMS_PER_PAGE const endIndex = startIndex + ITEMS_PER_PAGE const currentPhotos = filteredShowcase.slice(startIndex, endIndex) return (

摄影作品展示

setSearchTerm(e.target.value)} className="max-w-md mx-auto" />
{currentPhotos.map((photo, index) => (
{photo.title}

{photo.title}

作者:{photo.author}

拍摄日期:{photo.date}

))}
第 {currentPage} 页,共 {totalPages} 页
) }