2024-06-20 12:09:48 +05:30
|
|
|
import { AlertDialog, AlertDialogBody, AlertDialogCloseButton, AlertDialogContent, AlertDialogFooter, AlertDialogOverlay, Button, useDisclosure } from "@chakra-ui/react";
|
|
|
|
|
import React, { useRef } from "react";
|
|
|
|
|
|
|
|
|
|
const CustomAlertDialog = ({ isOpen, onOpen, onClose, alertHandler, isLoading, message }) => {
|
|
|
|
|
// const cancelRef = useRef();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<AlertDialog
|
|
|
|
|
motionPreset="slideInBottom"
|
|
|
|
|
// leastDestructiveRef={cancelRef}
|
|
|
|
|
onClose={onClose}
|
|
|
|
|
isOpen={isOpen}
|
|
|
|
|
isCentered
|
|
|
|
|
>
|
|
|
|
|
<AlertDialogOverlay />
|
|
|
|
|
|
|
|
|
|
<AlertDialogContent w={400}>
|
|
|
|
|
<AlertDialogCloseButton className="web-text-xsmall link" />
|
2024-07-05 15:28:02 +05:30
|
|
|
<AlertDialogBody className="text-center web-text-large fw-bold" pt={10}>
|
2024-06-20 12:09:48 +05:30
|
|
|
{message}
|
|
|
|
|
</AlertDialogBody>
|
|
|
|
|
<AlertDialogFooter display={"flex"} justifyContent={"center"}>
|
|
|
|
|
<Button
|
|
|
|
|
size={"sm"}
|
|
|
|
|
// ref={cancelRef}
|
|
|
|
|
onClick={onClose}
|
2024-06-26 15:03:31 +05:30
|
|
|
rounded={'sm'}
|
2024-06-20 12:09:48 +05:30
|
|
|
>
|
|
|
|
|
No
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
isLoading={isLoading}
|
|
|
|
|
onClick={alertHandler}
|
|
|
|
|
size={"sm"}
|
2024-06-26 15:03:31 +05:30
|
|
|
rounded={'sm'}
|
2024-07-01 12:33:55 +05:30
|
|
|
colorScheme="green"
|
2024-06-20 12:09:48 +05:30
|
|
|
ml={3}
|
|
|
|
|
>
|
|
|
|
|
Yes
|
|
|
|
|
</Button>
|
|
|
|
|
</AlertDialogFooter>
|
|
|
|
|
</AlertDialogContent>
|
|
|
|
|
</AlertDialog>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default CustomAlertDialog;
|