From 8980fdcc39c8fd990ed08d978de085d4f76fa45f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B5=ED=9D=AC=20=EA=B9=80?= Date: Mon, 23 Dec 2024 13:17:45 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=EA=B2=80=EC=83=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/dialog/search/search.jsx | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/components/dialog/search/search.jsx b/src/components/dialog/search/search.jsx index f8a1a1e..c8d78a7 100644 --- a/src/components/dialog/search/search.jsx +++ b/src/components/dialog/search/search.jsx @@ -99,6 +99,30 @@ export default function Search({ ...props }) { // eslint-disable-next-line react-hooks/exhaustive-deps }, [state.category, state.subCategory, state.shop]); + const fileInputRef = React.useRef(null); + + // 이미지를 찾는 함수 + const handleImageSearch = () => { + if (fileInputRef.current) { + fileInputRef.current.click(); // 숨겨진 파일 입력을 트리거 + } + }; + + // 파일 선택 시 호출되는 함수 + const handleFileChange = (event) => { + const file = event.target.files?.[0]; + if (file) { + console.log('Selected File:', file); + + // 예: 파일을 서버에 업로드하거나 처리 + const reader = new FileReader(); + reader.onload = () => { + console.log('Image Preview URL:', reader.result); + }; + reader.readAsDataURL(file); + } + }; + return ( <> + +