import React, { useState } from 'react'; import { MajorProject } from "@/data/project"; import IndicatorDots from "@/components/common/IndicatorDots"; interface CommonModalProps { isOpen: boolean; onClose: () => void; item: MajorProject | null; } export const ProjectModal: React.FC = ({ isOpen, onClose, item }) => { const [currentIndex, setCurrentIndex] = useState(0); if (!isOpen || !item) return null; const images = item.subImgUrl ?? []; const handlePrev = () => { if (images.length === 0) return; setCurrentIndex((prev) => (prev === 0 ? images.length - 1 : prev - 1)); }; const handleNext = () => { if (images.length === 0) return; setCurrentIndex((prev) => (prev === images.length - 1 ? 0 : prev + 1)); }; return (
e.stopPropagation()} > {/* 닫기 버튼 */} {/* 제목 및 정보 */}

{item.title}

발주처 : {item.client}

계약금액 : {item.contractAmount}

공사기간 : {item.period}

{/* 이미지 및 컨트롤 */}
{images.length > 0 && ( {`image-${currentIndex}`} )}
{/* 페이지 인디케이터 */}
setCurrentIndex(index)} activeColorClass="bg-blue-900" inactiveColorClass="bg-blue-900/20" />
); };