Skip to content

Commit

Permalink
chore: adds optional on close callback to modal
Browse files Browse the repository at this point in the history
  • Loading branch information
cuserox committed Jun 24, 2024
1 parent 00b9c18 commit 364ddd2
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type ModalProps = {
showClose?: boolean;
backArrow?: boolean
close: () => void;
onCloseCallback?: () => void;
modal?: boolean;
onInteractOutside?: (event: Event) => void;
};
Expand Down Expand Up @@ -89,6 +90,7 @@ export function Modal({
modal = true,
backArrow = false,
onInteractOutside,
onCloseCallback,
}: ModalProps) {
const handleClose = React.useCallback(() => {
close();
Expand All @@ -97,6 +99,9 @@ export function Modal({
const handleOnOpenChange = React.useCallback(
(open) => {
if (!open) {
if (onCloseCallback) {
onCloseCallback();
}
close();
}
},
Expand Down

0 comments on commit 364ddd2

Please sign in to comment.