ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
40 lines • 2.29 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import * as React from 'react';
import { Translate } from "../i18n/Translate.js";
export var Confirm = function (_a) {
var isOpen = _a.isOpen, content = _a.content, onClose = _a.onClose, onConfirm = _a.onConfirm, title = _a.title, _b = _a.translateOptions, translateOptions = _b === void 0 ? {} : _b, _c = _a.titleTranslateOptions, titleTranslateOptions = _c === void 0 ? translateOptions : _c, _d = _a.contentTranslateOptions, contentTranslateOptions = _d === void 0 ? translateOptions : _d;
return isOpen ? (React.createElement("div", { style: {
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'rgba(0, 0, 0, 0.3)',
} },
React.createElement("div", { style: {
backgroundColor: 'rgba(0, 0, 0, 0.8)',
color: 'white',
padding: '1em',
} },
React.createElement("p", null, typeof title === 'string' ? (React.createElement(Translate, { i18nKey: title, options: __assign({ _: title }, titleTranslateOptions) })) : (title)),
React.createElement("p", null, typeof content === 'string' ? (React.createElement(Translate, { i18nKey: content, options: __assign({ _: content }, contentTranslateOptions) })) : (content)),
React.createElement("div", { style: { display: 'flex', gap: '1em' } },
React.createElement("button", { onClick: onConfirm, type: "button" },
React.createElement(Translate, { i18nKey: "ra.action.confirm" }, "Confirm")),
React.createElement("button", { onClick: onClose, type: "button" },
React.createElement(Translate, { i18nKey: "ra.action.cancel" }, "Cancel")))))) : null;
};
//# sourceMappingURL=Confirm.js.map