forked from Chonete-Builders/Starkcade
-
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.
mod: Created a modal that explains the game rules
Signed-off-by: RareMmemshima <[email protected]>
- Loading branch information
1 parent
afd9bc9
commit 1be5e54
Showing
2 changed files
with
30 additions
and
22 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
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,29 @@ | ||
const Modal = ({ isOpen, onClose, children }: { | ||
isOpen: boolean, | ||
onClose: ()=> void, | ||
children: React.ReactNode | ||
}) => { | ||
if (!isOpen) return null; | ||
|
||
return ( | ||
<div | ||
className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50" | ||
onClick={onClose} | ||
> | ||
<div | ||
className="modal-box modal-border bg-modal rounded-[8px] border flex flex-col gap-3 justify-around relative " | ||
onClick={(e) => e.stopPropagation()} | ||
> | ||
<button | ||
onClick={onClose} | ||
className="absolute top-4 right-4 text-gray-500 hover:text-gray-800" | ||
> | ||
✕ | ||
</button> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Modal; |