@atlaskit/editor-plugin-floating-toolbar
Version:
Floating toolbar plugin for @atlaskit/editor-core
42 lines • 1.89 kB
JavaScript
import React from 'react';
import Button from '@atlaskit/button/new';
import { messages } from '@atlaskit/editor-common/floating-toolbar';
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle } from '@atlaskit/modal-dialog';
import { Text } from '@atlaskit/primitives/compiled';
export const SimpleModal = props => {
const {
onConfirm,
onClose,
options,
intl: {
formatMessage
},
testId
} = props;
const heading = (options === null || options === void 0 ? void 0 : options.title) || formatMessage(messages.confirmModalDefaultHeading);
const okButtonLabel = (options === null || options === void 0 ? void 0 : options.okButtonLabel) || formatMessage(messages.confirmModalOK);
const cancelButtonLabel = (options === null || options === void 0 ? void 0 : options.cancelButtonLabel) || formatMessage(messages.confirmModalCancel);
return /*#__PURE__*/React.createElement(Modal, {
onClose: onClose,
testId: testId
}, /*#__PURE__*/React.createElement(ModalHeader, {
hasCloseButton: true
}, /*#__PURE__*/React.createElement(ModalTitle, {
appearance: "warning"
}, heading)), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Text, {
as: "p"
}, options === null || options === void 0 ? void 0 : options.message)), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
appearance: "default",
onClick: onClose,
testId: testId ? `${testId}-cancel-button` : undefined
}, cancelButtonLabel), /*#__PURE__*/React.createElement(Button, {
appearance: "warning"
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
,
onClick: () => {
onConfirm();
onClose();
},
testId: testId ? `${testId}-confirm-button` : undefined
}, okButtonLabel)));
};