mirror of
https://github.com/Amperra-Group/xcs.git
synced 2025-10-15 11:52:18 -06:00
63 lines
1.4 KiB
TypeScript
63 lines
1.4 KiB
TypeScript
import {
|
|
AlertDialog,
|
|
AlertDialogBody,
|
|
AlertDialogCloseButton,
|
|
AlertDialogContent,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogOverlay,
|
|
Button,
|
|
useColorModeValue
|
|
} from '@chakra-ui/react';
|
|
|
|
export default function DeleteDialog({
|
|
isOpen,
|
|
onClose,
|
|
cancelRef,
|
|
onDelete,
|
|
title,
|
|
body,
|
|
buttonText = 'Delete'
|
|
}: any) {
|
|
return (
|
|
<>
|
|
<AlertDialog
|
|
isOpen={isOpen}
|
|
leastDestructiveRef={cancelRef}
|
|
onClose={onClose}
|
|
isCentered
|
|
>
|
|
<AlertDialogOverlay>
|
|
<AlertDialogContent bg={useColorModeValue('white', 'gray.800')}>
|
|
<AlertDialogHeader
|
|
fontSize="lg"
|
|
fontWeight="bold"
|
|
pb={2}
|
|
>
|
|
{title ? title : 'Delete item'}
|
|
</AlertDialogHeader>
|
|
|
|
<AlertDialogBody>{body ? body : "Are you sure? You can't undo this action afterwards."}</AlertDialogBody>
|
|
|
|
<AlertDialogFooter>
|
|
<Button
|
|
ref={cancelRef}
|
|
onClick={onClose}
|
|
>
|
|
Cancel
|
|
</Button>
|
|
<Button
|
|
colorScheme={'red'}
|
|
onClick={onDelete}
|
|
ml={3}
|
|
>
|
|
{buttonText}
|
|
</Button>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialogOverlay>
|
|
</AlertDialog>
|
|
</>
|
|
);
|
|
}
|