From 6755e4eb7618c92c1beac948ed5706a75a690f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=ED=9A=A8=EC=9B=90?= Date: Tue, 29 Oct 2024 20:37:04 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=8D=B8=EB=84=A4=EC=9D=BC=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/EditorPage/ThumbnailModal.jsx | 23 +++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/components/EditorPage/ThumbnailModal.jsx b/src/components/EditorPage/ThumbnailModal.jsx index edd041d..ff35c40 100644 --- a/src/components/EditorPage/ThumbnailModal.jsx +++ b/src/components/EditorPage/ThumbnailModal.jsx @@ -11,7 +11,7 @@ const ThumbnailModal = ({ thumbnailImage, isEdit, }) => { - const [thumbnail, setThumbnail] = React.useState(null); + const [thumbnail, setThumbnail] = React.useState(thumbnailImage); const isMobile = useMediaQuery("(max-width:550px)"); const handleFileChange = (event) => { @@ -23,6 +23,13 @@ const ThumbnailModal = ({ document.getElementById("file-input").click(); }; + const getThumbnailSrc = () => { + // File 타입인지 확인하여 URL을 생성하거나 기존 URL을 사용 + return thumbnail instanceof File + ? URL.createObjectURL(thumbnail) + : thumbnailImage; + }; + return ( - {/* 수정 중이고 썸네일 null인 경우 기존 썸네일 출력 */} - {isEdit && !thumbnail ? ( + {thumbnail && ( Thumbnail Preview - ) : ( - thumbnail && ( - Thumbnail Preview - ) )}