From f46615cffa2b3add4d937d1531ab924ee261d13a Mon Sep 17 00:00:00 2001 From: Jeon Eonseok Date: Wed, 7 Aug 2024 20:50:24 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=8C=8C=EC=9D=BC=20=EC=A0=9C=EA=B1=B0?= =?UTF-8?q?=20=ED=95=98=EA=B3=A0=20=ED=8C=8C=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=20=EC=8B=9C=20default=20file=20=EA=B7=B8=EB=8C=80=EB=A1=9C=20?= =?UTF-8?q?=EB=8F=8C=EC=95=84=EC=98=A4=EB=8A=94=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ApplyPage/components/FileInput/index.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/views/ApplyPage/components/FileInput/index.tsx b/src/views/ApplyPage/components/FileInput/index.tsx index b103ba6d..4b909708 100644 --- a/src/views/ApplyPage/components/FileInput/index.tsx +++ b/src/views/ApplyPage/components/FileInput/index.tsx @@ -69,6 +69,7 @@ const FileInput = ({ section, id, isReview, disabled, defaultFile }: FileInputPr fileName: file.name, }); getValues(`${section}${id}`) === '' && setValue(`${section}${id}`, '파일 제출'); + setValue(`file${id}Deleted`, false); setUploadPercent(-1); track(`done-apply-add_file${id}`); }); @@ -78,6 +79,7 @@ const FileInput = ({ section, id, isReview, disabled, defaultFile }: FileInputPr const handleDeleteFileValue = () => { setValue(`file${id}`, undefined); + setValue(`file${id}Deleted`, true); getValues(`${section}${id}`) === '파일 제출' && setValue(`${section}${id}`, ''); }; @@ -116,11 +118,16 @@ const FileInput = ({ section, id, isReview, disabled, defaultFile }: FileInputPr }; const getFileNameClass = () => { - return (!defaultFileName && fileName === '') || fileName === 'delete-file' ? 'default' : 'selected'; + return (!defaultFileName && fileName === '') || + (defaultFileName && getValues(`file${id}Deleted`)) || + fileName === 'delete-file' + ? 'default' + : 'selected'; }; const getDisplayText = () => { - if (uploadPercent === -1 && fileName === '' && defaultFileName) return defaultFileName; + if (uploadPercent === -1 && fileName === '' && defaultFileName && !getValues(`file${id}Deleted`)) + return defaultFileName; else if (uploadPercent === -1 && (fileName === '' || fileName === 'delete-file')) return '50mb 이하 | pdf'; else if (isFileUploading) return `업로드 중... ${uploadPercent}/100% 완료`; else if (isFileSending) return '파일을 전송하고 있어요... 잠시만 기다려주세요...'; @@ -128,6 +135,8 @@ const FileInput = ({ section, id, isReview, disabled, defaultFile }: FileInputPr }; useEffect(() => { + if (getValues(`file${id}Deleted`)) return; + if (getValues(`file${id}`)) { setFileName(getValues(`file${id}`).fileName); return;