(feat) add custom handle close prop for MuiModal
This commit is contained in:
@@ -13,6 +13,7 @@ export default function MuiModal({
|
||||
submitText,
|
||||
submitOnClick,
|
||||
disabled,
|
||||
handleCloseCustom,
|
||||
children,
|
||||
}: MuiModalProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
@@ -31,7 +32,7 @@ export default function MuiModal({
|
||||
<div>
|
||||
<Modal
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
onClose={handleCloseCustom || handleClose}
|
||||
aria-labelledby="modal-modal-title"
|
||||
aria-describedby="modal-modal-description"
|
||||
className="relative w-full h-full flex justify-center items-center !border-none !outline-none !ring-0"
|
||||
@@ -49,7 +50,7 @@ export default function MuiModal({
|
||||
<span className="text-secondTheme"> {nameService} </span>
|
||||
)}
|
||||
</h1>
|
||||
<button onClick={handleClose}>
|
||||
<button onClick={handleCloseCustom || handleClose}>
|
||||
<IoClose className="w-7 h-7" />
|
||||
</button>
|
||||
</motion.div>
|
||||
@@ -61,9 +62,13 @@ export default function MuiModal({
|
||||
submitText ? "justify-end" : "justify-center"
|
||||
} items-center gap-2 md:gap-3 text-lg md:text-xl`}
|
||||
>
|
||||
<Button onClick={() => handleClose()}> بستن </Button>
|
||||
<Button onClick={handleCloseCustom || handleClose}> بستن </Button>
|
||||
{submitText && (
|
||||
<Button extra={`${disabled && '!bg-slate-300'}`} onClick={submitOnClick} disabled={disabled}>
|
||||
<Button
|
||||
extra={`${disabled && "!bg-slate-300"}`}
|
||||
onClick={submitOnClick}
|
||||
disabled={disabled}
|
||||
>
|
||||
{" "}
|
||||
{submitText}{" "}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user