-
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.
modal window only appears if the problem is solved
- Loading branch information
1 parent
7d8d28f
commit f095322
Showing
8 changed files
with
77 additions
and
37 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
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,21 +1,32 @@ | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { faClose } from "@fortawesome/free-solid-svg-icons"; | ||
|
||
function Modal({children, isOpen, onClose}) { | ||
function Modal({ children, isOpen, onClose }) { | ||
return ( | ||
<> | ||
{isOpen && | ||
<div className="z-40 fixed inset-0 bg-black opacity-50" onClick={onClose}> | ||
<button onClick={onClose} className="flex items-center justify-center absolute top-2 right-2 p-2 rounded-full bg-transparent hover:bg-grey-100 dark:hover:bg-grey-800"> | ||
<FontAwesomeIcon icon={faClose} className="w-6 h-6 text-white" /> | ||
{isOpen && ( | ||
<div | ||
className="z-40 fixed inset-0 bg-black opacity-50" | ||
onClick={onClose}> | ||
<button | ||
onClick={onClose} | ||
className="flex items-center justify-center absolute top-2 right-2 p-2 rounded-full bg-transparent hover:bg-grey-100 dark:hover:bg-grey-800"> | ||
<FontAwesomeIcon | ||
icon={faClose} | ||
className="w-6 h-6 text-white" | ||
/> | ||
</button> | ||
</div>} | ||
{isOpen && | ||
<div className="z-50 fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2" onClick={(event) => event.stopPropagation()}> | ||
</div> | ||
)} | ||
{isOpen && ( | ||
<div | ||
className="z-50 fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2" | ||
onClick={(event) => event.stopPropagation()}> | ||
{children} | ||
</div>} | ||
</div> | ||
)} | ||
</> | ||
) | ||
); | ||
} | ||
|
||
export default Modal | ||
export default Modal; |
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
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
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