Skip to content

Commit

Permalink
Merge pull request #334 from Aar-if/modern
Browse files Browse the repository at this point in the history
Issue #0000 feat: Modal bug fixes
  • Loading branch information
itsvick authored Nov 21, 2024
2 parents 6fcd0be + 5795910 commit 2f0a9ca
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/components/AddBlockModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export const AddBlockModal: React.FC<AddBlockModalProps> = ({

const districtCodeArray = districts.map((item: any) => item.value);
setDistrictCodeArr(districtCodeArray);

} catch (error) {
console.error("Error fetching districts", error);
}
Expand Down Expand Up @@ -296,7 +295,14 @@ export const AddBlockModal: React.FC<AddBlockModalProps> = ({
: t("COMMON.ADD_BLOCK");

return (
<Dialog open={open} onClose={onClose}>
<Dialog
open={open}
onClose={(event, reason) => {
if (reason !== "backdropClick") {
onClose();
}
}}
>
<DialogTitle sx={{ fontSize: "14px" }}>{dialogTitle}</DialogTitle>
<Divider />
<DialogContent>
Expand Down
9 changes: 8 additions & 1 deletion src/components/AddDistrictModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,14 @@ const AddDistrictModal: React.FC<AddDistrictBlockModalProps> = ({
: t("COMMON.ADD_DISTRICT");

return (
<Dialog open={open} onClose={onClose}>
<Dialog
open={open}
onClose={(event, reason) => {
if (reason !== "backdropClick") {
onClose();
}
}}
>
<DialogTitle sx={{ fontSize: "14px" }}>{dialogTitle}</DialogTitle>
<Divider />
<DialogContent>
Expand Down
11 changes: 9 additions & 2 deletions src/components/AddStateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const AddStateModal: React.FC<AddStateModalProps> = ({
newErrors.name = t("COMMON.STATE_NAME_REQUIRED");
} else if (!isValidName(formData.name.trim())) {
newErrors.name = t("COMMON.INVALID_TEXT");
}
}

if (!formData.value) {
newErrors.value = t("COMMON.CODE_REQUIRED");
Expand All @@ -113,7 +113,14 @@ export const AddStateModal: React.FC<AddStateModalProps> = ({
};

return (
<Dialog open={open} onClose={onClose}>
<Dialog
open={open}
onClose={(event, reason) => {
if (reason !== "backdropClick") {
onClose();
}
}}
>
<DialogTitle sx={{ fontSize: "14px" }}>
{stateId ? t("COMMON.UPDATE_STATE") : t("COMMON.ADD_STATE")}
</DialogTitle>
Expand Down
6 changes: 5 additions & 1 deletion src/components/ConfirmationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ const ConfirmationModal: React.FC<ConfirmationModalProps> = ({
return (
<Modal
open={modalOpen}
onClose={handleCloseModal}
onClose={(event, reason) => {
if (reason !== "backdropClick") {
handleCloseModal();
}
}}
aria-labelledby="confirmation-modal-title"
aria-describedby="confirmation-modal-description"
>
Expand Down
11 changes: 10 additions & 1 deletion src/components/FileUploadDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@ const FileUploadDialog: React.FC<FileUploadDialogProps> = ({

return (
<Box>
<Dialog open={open} onClose={onClose} maxWidth="lg" fullWidth>
<Dialog
open={open}
onClose={(event, reason) => {
if (reason !== "backdropClick") {
onClose();
}
}}
maxWidth="lg"
fullWidth
>
<Box sx={{ display: "flex", flexDirection: "column" }}>
<Box
sx={{
Expand Down
6 changes: 5 additions & 1 deletion src/components/SimpleModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ const SimpleModal: React.FC<SimpleModalProps> = ({
return (
<Modal
open={open}
onClose={onClose}
onClose={(event, reason) => {
if (reason !== "backdropClick") {
onClose();
}
}}
aria-labelledby="child-modal-title"
aria-describedby="child-modal-description"
>
Expand Down

0 comments on commit 2f0a9ca

Please sign in to comment.