refactor: optimze modal

This commit is contained in:
2026-10-02 13:37:59 +03:30
parent 800efeb784
commit 1ce33d9b74
4 changed files with 42 additions and 37 deletions

View File

@@ -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>