feat : optimaze code by eslint
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Modal from "@mui/material/Modal";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { motion } from "framer-motion";
|
||||
import { IoClose } from "react-icons/io5";
|
||||
import Button from "../../components/button";
|
||||
@@ -17,15 +17,15 @@ export default function MuiModal({
|
||||
}: MuiModalProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const handleOpen = () => setOpen(true);
|
||||
const handleClose = () => {
|
||||
const handleClose = useCallback(() => {
|
||||
setOpen(false);
|
||||
setIsOpenModal(false);
|
||||
};
|
||||
}, [setIsOpenModal]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpenModal) handleOpen();
|
||||
else handleClose();
|
||||
}, [isOpenModal]);
|
||||
}, [isOpenModal, handleClose]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -63,7 +63,10 @@ export default function MuiModal({
|
||||
>
|
||||
<Button onClick={() => handleClose()}> بستن </Button>
|
||||
{submitText && (
|
||||
<Button onClick={submitOnClick} disabled={disabled}> {submitText} </Button>
|
||||
<Button extra={`${disabled && '!bg-slate-300'}`} onClick={submitOnClick} disabled={disabled}>
|
||||
{" "}
|
||||
{submitText}{" "}
|
||||
</Button>
|
||||
)}
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
|
||||
Reference in New Issue
Block a user