Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c1ee00

Browse files
committed
Close the modal when clicked on overlay
1 parent 56e41ca commit 2c1ee00

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/modal/Modal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ export default function Modal({
3838
className="fixed inset-0 transition-opacity"
3939
aria-hidden="true"
4040
>
41-
<div className="absolute inset-0 bg-gray-500 opacity-75"></div>
41+
<div
42+
className="absolute inset-0 bg-gray-500 opacity-75"
43+
onClick={() => setIsOpen(false)}
44+
></div>
4245
</Transition>
4346

4447
<span

0 commit comments

Comments
 (0)