diff --git a/frontend/src/features/list/components/ActionSection.tsx b/frontend/src/features/list/components/ActionSection.tsx index 36ce83c..5a52efc 100644 --- a/frontend/src/features/list/components/ActionSection.tsx +++ b/frontend/src/features/list/components/ActionSection.tsx @@ -5,17 +5,42 @@ const PILL = 'text-lg font-semibold whitespace-nowrap ' + interactive -export function ActionSection() { +export interface ActionSectionProps { + isParticipating: boolean + isRejecting: boolean + onParticipate: () => void + onReject: () => void +} + +export function ActionSection({ + isParticipating, + isRejecting, + onParticipate, + onReject, +}: ActionSectionProps) { return (
- {/* TODO: 협상 참여 동작 연동 */} - - {/* TODO: 거부 동작 연동 */} + diff --git a/frontend/src/features/list/components/RejectPopup.tsx b/frontend/src/features/list/components/RejectPopup.tsx new file mode 100644 index 0000000..d7f2d45 --- /dev/null +++ b/frontend/src/features/list/components/RejectPopup.tsx @@ -0,0 +1,124 @@ +import { useState } from 'react' +import { Modal } from '@/components' +import { cn, interactive } 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 + + const reason = isEtcOpen ? customReason.trim() : selectedReason + onSubmit(reason) + onClose() + } + + return ( + +
+ {/* 헤더 */} +

+ 거부 사유를 입력해주세요 +

+ + {/* 사유 선택 */} +
+ {REASONS.map((reason) => ( + + ))} +
+ + {/* 기타 입력 + 에러 */} +
+
+