Skip to content

Commit

Permalink
Merge pull request #104 from oreumi-dreamer/jinhui
Browse files Browse the repository at this point in the history
💄 댓글 작성 중 모달 나가기 또는 딤드 클릭 시 confirm 을 기본 window 에서 컴포넌트 디자인으로 수정
  • Loading branch information
jini0012 authored Dec 17, 2024
2 parents 4ce28b7 + 0ddfc9a commit 475f1c6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/components/modal/PostModal.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import React, { useState } from "react";
import styles from "./PostModal.module.css";
import PostContent from "../post/PostContent";
import { ConfirmModal } from "../Controls";

export default function PostModal({ postId, isShow, onClose }) {
const [isModalOpen, setIsModalOpen] = useState(false);
const [isLoading, setIsLoading] = useState(true);
const [comment, setComment] = useState(undefined);
const [isConfirmModalOpen, setIsConfirmModalOpen] = useState(false);

function handleModalClose() {
if (comment) {
const exitAnswer = confirm("댓글을 작성중입니다. 종료하시겠습니까?");
if (!exitAnswer) return;
setIsConfirmModalOpen(true);
return;
}
setIsModalOpen(false);
onClose();
Expand All @@ -37,6 +39,20 @@ export default function PostModal({ postId, isShow, onClose }) {
setComment={setComment}
/>
</dialog>
{isConfirmModalOpen && (
<ConfirmModal
onConfirm={() => {
setIsModalOpen(false);
onClose();
setComment(undefined);
setIsLoading(true);
setIsConfirmModalOpen(false);
}}
isOpen={() => setIsConfirmModalOpen(true)}
closeModal={() => setIsConfirmModalOpen(false)}
message="댓글을 작성중입니다. 종료하시겠습니까?"
/>
)}
</>
) : null}
</>
Expand Down

0 comments on commit 475f1c6

Please sign in to comment.