UNPKG

@atlaskit/editor-plugin-floating-toolbar

Version:

Floating toolbar plugin for @atlaskit/editor-core

38 lines 1.98 kB
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 var SimpleModal = function SimpleModal(props) { var onConfirm = props.onConfirm, onClose = props.onClose, options = props.options, formatMessage = props.intl.formatMessage, testId = props.testId; var heading = (options === null || options === void 0 ? void 0 : options.title) || formatMessage(messages.confirmModalDefaultHeading); var okButtonLabel = (options === null || options === void 0 ? void 0 : options.okButtonLabel) || formatMessage(messages.confirmModalOK); var 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 ? "".concat(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: function onClick() { onConfirm(); onClose(); }, testId: testId ? "".concat(testId, "-confirm-button") : undefined }, okButtonLabel))); };