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