@quillforms/block-editor
Version:
84 lines (82 loc) • 2.34 kB
JavaScript
/**
* QuillForms Dependencies
*/
import { Button } from '@quillforms/admin-components';
/**
* WordPress Dependencies
*/
import { Modal } from '@wordpress/components';
/**
* External Dependencies
*/
import classnames from 'classnames';
import { css } from 'emotion';
import { size } from 'lodash';
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
const DeleteAlertModal = ({
messages,
approve,
reject,
closeModal
}) => {
return /*#__PURE__*/_jsxs(Modal, {
className: classnames('block-editor-delete-alert-modal', css`
border: none ;
min-width: 420px ;
max-width: 470px ;
border-radius: 10px;
z-index: 1111111;
`)
// Because focus on editor is causing the click handler to be triggered
,
shouldCloseOnClickOutside: false,
title: "Warning!",
onRequestClose: closeModal,
children: [/*#__PURE__*/_jsxs("div", {
children: [/*#__PURE__*/_jsx("div", {
children: "Are you sure you want to delete this item? All of its data will be deleted."
}), size(messages) > 0 && /*#__PURE__*/_jsxs(_Fragment, {
children: [/*#__PURE__*/_jsx("div", {
children: messages.length === 1 ? messages[0] : messages.map((message, index) => /*#__PURE__*/_jsx("div", {
children: `${index + 1}. ${message}`
}, index))
}), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx("div", {
children: "Are you sure you want to proceed?"
})]
})]
}), /*#__PURE__*/_jsxs("div", {
className: css`
display: flex;
margin-top: 20px;
justify-content: flex-end;
`,
children: [/*#__PURE__*/_jsx(Button, {
isDefault: true,
isLarge: true,
className: css`
margin-right: 10px ;
`,
onClick: () => {
reject();
},
children: "Cancel"
}), /*#__PURE__*/_jsx(Button, {
isLarge: true,
isDanger: true,
className: css`
width: 70px;
display: flex;
justify-content: center;
align-items: center;
`,
onClick: () => {
approve();
},
isPrimary: true,
children: "Delete"
})]
})]
});
};
export default DeleteAlertModal;
//# sourceMappingURL=index.js.map