refactor: optimze modal
This commit is contained in:
@@ -14,6 +14,7 @@ export default function MuiModal({
|
||||
submitOnClick,
|
||||
disabled,
|
||||
handleCloseCustom,
|
||||
aboveSubmit,
|
||||
children,
|
||||
}: MuiModalProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
@@ -57,22 +58,27 @@ export default function MuiModal({
|
||||
<motion.div className="w-full flex-1 flex flex-col justify-between text-center items-center overflow-y-auto">
|
||||
{children}
|
||||
</motion.div>
|
||||
<motion.div
|
||||
className={`w-full h-full flex ${
|
||||
submitText ? "justify-end" : "justify-center"
|
||||
} items-center gap-2 md:gap-3 text-lg md:text-xl`}
|
||||
>
|
||||
<Button onClick={handleCloseCustom || handleClose}> بستن </Button>
|
||||
{submitText && (
|
||||
<Button
|
||||
extra={`${disabled && "!bg-slate-300"}`}
|
||||
onClick={submitOnClick}
|
||||
disabled={disabled}
|
||||
>
|
||||
{" "}
|
||||
{submitText}{" "}
|
||||
</Button>
|
||||
<motion.div className="w-full h-full flex flex-col gap-2">
|
||||
{aboveSubmit && (
|
||||
<div className="w-full flex justify-center">{aboveSubmit}</div>
|
||||
)}
|
||||
<motion.div
|
||||
className={`w-full h-full flex ${
|
||||
submitText ? "justify-end" : "justify-center"
|
||||
} items-center gap-2 md:gap-3 text-lg md:text-xl`}
|
||||
>
|
||||
<Button onClick={handleCloseCustom || handleClose}> بستن </Button>
|
||||
{submitText && (
|
||||
<Button
|
||||
extra={`${disabled && "!bg-slate-300"}`}
|
||||
onClick={submitOnClick}
|
||||
disabled={disabled}
|
||||
>
|
||||
{" "}
|
||||
{submitText}{" "}
|
||||
</Button>
|
||||
)}
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user