2021-03-20 16:51:34 +01:00
|
|
|
import React from 'react';
|
2021-10-14 17:13:12 +02:00
|
|
|
|
2021-10-27 13:28:06 +02:00
|
|
|
import { Dialog, DialogBody, DialogFooter } from '@strapi/design-system/Dialog';
|
|
|
|
import { Flex } from '@strapi/design-system/Flex';
|
|
|
|
import { Text } from '@strapi/design-system/Text';
|
|
|
|
import { Stack } from '@strapi/design-system/Stack';
|
|
|
|
import { Button } from '@strapi/design-system/Button';
|
2021-10-27 13:45:55 +02:00
|
|
|
import DeleteIcon from '@strapi/icons/Delete';
|
2021-10-14 17:13:12 +02:00
|
|
|
import AlertWarningIcon from '@strapi/icons/AlertWarningIcon';
|
2021-03-20 16:51:34 +01:00
|
|
|
|
|
|
|
import getTrad from '../../helpers/getTrad';
|
|
|
|
|
|
|
|
const ConfirmModal = ({ isOpen, onClose, onSubmit, type }) => {
|
2021-03-21 17:55:14 +01:00
|
|
|
if (!isOpen) return null;
|
|
|
|
|
2021-03-20 16:51:34 +01:00
|
|
|
return (
|
2021-10-14 17:13:12 +02:00
|
|
|
<Dialog
|
|
|
|
onClose={onClose}
|
|
|
|
title="Confirmation"
|
2021-03-20 16:51:34 +01:00
|
|
|
isOpen={isOpen}
|
2021-10-14 17:13:12 +02:00
|
|
|
>
|
|
|
|
<DialogBody icon={<AlertWarningIcon />}>
|
|
|
|
<Stack size={2}>
|
2021-10-27 13:28:06 +02:00
|
|
|
<Flex justifyContent="center">
|
2021-10-14 17:13:12 +02:00
|
|
|
<Text id="confirm-description">{getTrad(`popUpWarning.warning.${type}`)}</Text>
|
2021-10-27 13:28:06 +02:00
|
|
|
</Flex>
|
2021-10-14 17:13:12 +02:00
|
|
|
</Stack>
|
|
|
|
</DialogBody>
|
|
|
|
<DialogFooter
|
|
|
|
startAction={(
|
|
|
|
<Button
|
|
|
|
onClick={() => {
|
|
|
|
onClose();
|
|
|
|
onSubmit();
|
|
|
|
}}
|
|
|
|
variant="tertiary"
|
|
|
|
>
|
|
|
|
Cancel
|
|
|
|
</Button>
|
|
|
|
)}
|
|
|
|
endAction={(
|
|
|
|
<Button variant="danger-light" startIcon={<DeleteIcon />}>
|
|
|
|
{getTrad(`popUpWarning.button.${type}`)}
|
|
|
|
</Button>
|
|
|
|
)} />
|
|
|
|
</Dialog>
|
2021-03-20 16:51:34 +01:00
|
|
|
);
|
2021-10-14 17:13:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default ConfirmModal;
|