"use client"; /** * 좌우 버튼 표시 모드 * * 화살표 버튼으로 아이템을 한 장씩 넘기는 모드 * 터치 최적화: 최소 44x44px 터치 영역 */ import React, { useState, useCallback } from "react"; import { ChevronLeft, ChevronRight } from "lucide-react"; // ===== Props ===== export interface ArrowsModeProps { /** 총 아이템 수 */ itemCount: number; /** 페이지 인디케이터 표시 여부 */ showIndicator?: boolean; /** 현재 인덱스에 해당하는 아이템 렌더링 */ renderItem: (index: number) => React.ReactNode; } // ===== 메인 컴포넌트 ===== export function ArrowsModeComponent({ itemCount, showIndicator = true, renderItem, }: ArrowsModeProps) { const [currentIndex, setCurrentIndex] = useState(0); const goToPrev = useCallback(() => { setCurrentIndex((prev) => (prev > 0 ? prev - 1 : itemCount - 1)); }, [itemCount]); const goToNext = useCallback(() => { setCurrentIndex((prev) => (prev < itemCount - 1 ? prev + 1 : 0)); }, [itemCount]); if (itemCount === 0) { return (