import { useState } from 'react' import { X } from 'lucide-react' import { Modal } from '@/components' import { cn } from '@/lib' const REASONS = ['단종', '품절', '기타'] as const export interface RejectPopupProps { onClose: () => void /** 최종 거부 사유 (프리셋 라벨 또는 기타 입력 텍스트) */ onSubmit: (reason: string) => void } // 거부 사유 입력 팝업 (단종/품절/기타). export function RejectPopup({ onClose, onSubmit }: RejectPopupProps) { const [selectedReason, setSelectedReason] = useState(null) const [customReason, setCustomReason] = useState('') const [showError, setShowError] = useState(false) const isEtcOpen = selectedReason === '기타' const isSubmitDisabled = !selectedReason || (isEtcOpen && !customReason.trim()) const handleReasonClick = (reason: string) => { setShowError(false) if (selectedReason === reason) { setSelectedReason(null) setCustomReason('') } else { setSelectedReason(reason) if (reason !== '기타') setCustomReason('') } } const handleSubmit = () => { if (isEtcOpen && !customReason.trim()) { setShowError(true) return } if (isSubmitDisabled || !selectedReason) return onSubmit(isEtcOpen ? customReason.trim() : selectedReason) onClose() } return (
{/* 헤더 */}

거부 사유를 입력해주세요

{/* 본문 */}
{REASONS.map((reason) => ( ))}
{isEtcOpen && (