-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created an exit button on quiz section
- Loading branch information
Showing
2 changed files
with
48 additions
and
16 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: 18 additions & 16 deletions
34
nepalingo-web/src/components/header/ExitConfirmationModal.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 |
---|---|---|
@@ -1,35 +1,37 @@ | ||
import React from "react" | ||
interface ExitConfrimationModalProps { | ||
import React from "react"; | ||
|
||
interface ExitConfirmationModalProps { | ||
show: boolean; | ||
onConfirm: (confirm: boolean) => void; | ||
} | ||
const ExitConfrimationModal: React.FC<ExitConfrimationModalProps> = ({ | ||
|
||
const ExitConfirmationModal: React.FC<ExitConfirmationModalProps> = ({ | ||
show, | ||
onConfirm | ||
}) => { | ||
if (!show) return null; | ||
|
||
function confirmExit(arg0: boolean): void { | ||
throw new Error("Function not implemented."); | ||
} | ||
|
||
return ( | ||
<div className="fixed inset-0 bg-black-600 bg-opacity-50 flex items-center justify-center"> | ||
<div className=" bg-red p-6 rounded shadow-lg text-center"> | ||
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center"> | ||
<div className="bg-white p-4 rounded shadow-lg text-center"> | ||
<p className="mb-4">Are you sure you want to exit?</p> | ||
<div className="flex justify-center space x-6"> | ||
<button className="bg-red-600 text-white p-2 rounded hover:bg-red-700" | ||
onClick={() => confirmExit(true)}> | ||
<div className="flex justify-center space-x-6"> | ||
<button | ||
className="bg-white-600 text-black p-3 rounded hover:bg-red-700" | ||
onClick={() => onConfirm(true)} | ||
> | ||
Yes | ||
</button> | ||
<button className="bg-green-600 text-white p-2 rounded hover:bg-green-700" | ||
onClick={() => confirmExit(false)}> | ||
<button | ||
className="bg-white-600 text-black p-3 rounded hover:bg-green-700" | ||
onClick={() => onConfirm(false)} | ||
> | ||
No | ||
|
||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
export default ExitConfirmationModal; | ||
|
||
export default ExitConfirmationModal; |