Skip to content

Commit

Permalink
add :: 버그이미지 미리보기
Browse files Browse the repository at this point in the history
add :: 버그이미지 미리보기
  • Loading branch information
phyuna0525 authored Aug 13, 2024
2 parents 4f06498 + 9271708 commit e94a8eb
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 22 deletions.
69 changes: 49 additions & 20 deletions src/app/bugReport/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,26 +106,55 @@ const BugReport = () => {
/>
</div>
<div className="mb-11">
<>
<p>버그 사진을 첨부해주세요</p>
<label
htmlFor="file-input"
className="cursor-pointer flex flex-col p-8 justify-center items-center w-full h-max rounded-md bg-neutral-900 text-gray-500 mb-9"
onClick={() => {
setModal(true);
}}
>
<img src={BugReportImg.src} alt="bug report icon" />
<p>사진을 첨부해주세요</p>
</label>
<div
id="file-input"
className="hidden"
onChange={() => {
setModal(!modal);
}}
/>
</>
{data.file_name.length === 0 ? (
<>
<p>버그 사진을 첨부해주세요</p>
<label
htmlFor="file-input"
className="cursor-pointer flex flex-col p-8 justify-center items-center w-full h-max rounded-md bg-neutral-900 text-gray-500 mb-9"
onClick={() => {
setModal(true);
}}
>
<img src={BugReportImg.src} alt="bug report icon" />
<p>사진을 첨부해주세요</p>
</label>
<div
id="file-input"
className="hidden"
onChange={() => {
setModal(!modal);
}}
/>
</>
) : (
<div className=" flex gap-1">
{data.file_name.map((item) => (
<img
src={`${process.env.NEXT_PUBLIC_FILE_APP}${item}`}
width={200}
height={200}
/>
))}
<label
htmlFor="file-input"
className="cursor-pointer flex flex-col p-8 justify-center items-center w-full h-max rounded-md bg-neutral-900 text-gray-500 mb-9"
onClick={() => {
setModal(true);
}}
>
<img src={BugReportImg.src} alt="bug report icon" />
<p>사진을 첨부해주세요</p>
</label>
<div
id="file-input"
className="hidden"
onChange={() => {
setModal(!modal);
}}
/>
</div>
)}
</div>
<ImgModal
onClick={handleImgUpload}
Expand Down
2 changes: 0 additions & 2 deletions src/app/components/common/modal/imgModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ const ImgModal: React.FC<ModalProps> = ({ isOpen, onClose, onClick }) => {

const onCancle = () => {
onClose();
setImages([]);
};

const AddImg = () => {
onClick(images);
setImages([]);
onClose();
};

Expand Down

0 comments on commit e94a8eb

Please sign in to comment.