Skip to content
8 changes: 2 additions & 6 deletions src/components/common/FileDropzone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ export default function FileDropzone({
const dragCounter = useRef(0);
const [isDragging, setIsDragging] = useState(false);
const isUploading = currentStep === 'uploading' || currentStep === 'finishing';
const isDisabled = disabled;
const isBlocked = isDisabled || isUploading; // 업로드 중에는 모든 입력 차단
const isBlocked = disabled || isUploading; // 업로드 중에는 모든 입력 차단

useEffect(() => {
if (error) showToast.warning('업로드에 실패했습니다.', error);
Expand All @@ -56,7 +55,6 @@ export default function FileDropzone({
const file = fileList.item(0);
if (!file) return;

if (typeof onFileSelected !== 'function') return;
onFileSelected(file);

if (inputRef.current) inputRef.current.value = ''; // 같은 파일 다시 선택 가능하게 (선택창 value 초기화)
Expand Down Expand Up @@ -101,15 +99,13 @@ export default function FileDropzone({
const file = e.dataTransfer.files?.item(0);
if (!file) return;

if (typeof onFileSelected !== 'function') return;
onFileSelected(file);
};

/** 업로드 취소 */
const handleCancelUploading = (e: React.MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
e.stopPropagation();
if (typeof onCancelUpload !== 'function') return;
onCancelUpload();
};

Expand Down Expand Up @@ -147,7 +143,7 @@ export default function FileDropzone({
onDrop={handleDrop}
className={clsx(
'group relative w-full overflow-hidden rounded-2xl border bg-white px-8 py-14 shadow-sm transition focus:ring-1 focus:ring-gray-200',
isDisabled && !isUploading && 'cursor-not-allowed opacity-60',
disabled && !isUploading && 'cursor-not-allowed opacity-60',
isUploading && 'cursor-default',
!isBlocked && 'cursor-pointer hover:bg-gray-100',
showDragOverlay ? 'border-gray-900 ring-1 ring-gray-200' : 'border-gray-200',
Expand Down