-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 게임페이지에서 나가기 버튼 클릭 시 경고 팝업 띄우도록 수정
- Loading branch information
Showing
2 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/frontend/src/components/gamePage/rightSection/LeaveConfirmModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import ReactDOM from 'react-dom'; | ||
|
||
interface ILeaveConfirmModalProps { | ||
onConfirm: () => void; | ||
onClose: () => void; | ||
} | ||
|
||
export default function LeaveConfirmModal({ onConfirm, onClose }: ILeaveConfirmModalProps) { | ||
const modalContent = ( | ||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50"> | ||
<div className="max-w-lg p-8 bg-white shadow-lg rounded-2xl w-96"> | ||
<h2 className="mb-4 text-xl font-semibold text-center text-gray-900"> | ||
게임을 나가시겠습니까? | ||
</h2> | ||
<div className="flex justify-center gap-4 mt-4"> | ||
<button | ||
onClick={onClose} | ||
className="w-32 py-2 text-black border border-black rounded-lg hover:bg-gray-100" | ||
> | ||
취소 | ||
</button> | ||
<button | ||
onClick={onConfirm} | ||
className="w-32 py-2 bg-black rounded-lg text-white-default hover:bg-gray-800" | ||
> | ||
확인 | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
return ReactDOM.createPortal(modalContent, document.getElementById('portal-root') as HTMLElement); | ||
} |