Skip to content

Commit

Permalink
Merge pull request #59 from dalurness/du/q2Changes
Browse files Browse the repository at this point in the history
make answer modal one component
  • Loading branch information
dalurness authored Nov 15, 2024
2 parents 657ddd3 + 5231d2f commit 967ee5f
Show file tree
Hide file tree
Showing 3 changed files with 461 additions and 467 deletions.
41 changes: 41 additions & 0 deletions src/components/RightWrongModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { MdOutlineDangerous, MdOutlineVerified } from "react-icons/md";
import { Dialog } from "./Dialog";
import { Button } from "./Button";

export enum ModalStatusType {
Correct = "correct",
Incorrect = "incorrect",
Closed = "closed",
}

type Props = {
showModal: `${ModalStatusType}`,
setShowModal: React.Dispatch<React.SetStateAction<ModalStatusType>>,
}
export function RightWrongModal({ showModal, setShowModal }: Props) {
return (
<Dialog
open={showModal !== ModalStatusType.Closed}
onToggle={(open) => !open && setShowModal(ModalStatusType.Closed)}
>
<div className="flex flex-col items-center px-4 py-3 sm:px-6">
{showModal === ModalStatusType.Correct ? (
<>
<MdOutlineVerified size={48} className="text-teal-600 mb-4" />
<span>You got it right!</span>
</>
) : (
<>
<MdOutlineDangerous size={48} className="text-red-600 mb-4" />
<span>Uh oh! That's not right</span>
</>
)}
</div>
<div className="flex justify-end bg-yeti-light-3 mt-3 px-4 py-3 sm:px-6">
<Button onClick={() => setShowModal(ModalStatusType.Closed)}>
{showModal === "correct" ? "Yay!" : "Try again"}
</Button>
</div>
</Dialog>
)
}
Loading

0 comments on commit 967ee5f

Please sign in to comment.