UNPKG

pzl-react-reusable-components

Version:
22 lines 1.55 kB
import { Button, Dialog, DialogActions, DialogBody, DialogSurface, DialogTitle, Field, Textarea } from '@fluentui/react-components'; import React, { useState } from 'react'; export var ConfirmDialog = function (props) { var _a = useState(null), comment = _a[0], setComment = _a[1]; return (React.createElement(Dialog, { open: !!props.onResponse }, React.createElement(DialogSurface, null, React.createElement(DialogTitle, null, props.title), React.createElement(DialogBody, null, React.createElement("div", null, React.createElement("p", null, props.subText), React.createElement("div", { hidden: !props.enableCommentsField }, React.createElement(Field, null, React.createElement(Textarea, { style: { width: '550px' }, placeholder: props.commentsFieldPlaceholder, onChange: function (_, _a) { var value = _a.value; setComment(value); } }))))), React.createElement(DialogActions, null, props.responses.map(function (_a, idx) { var text = _a[0], value = _a[1], primary = _a[2]; return (React.createElement(Button, { key: idx, appearance: primary ? 'primary' : 'secondary', onClick: function () { return props.onResponse(value !== null && value !== void 0 ? value : text, comment); } }, text)); }))))); }; //# sourceMappingURL=ConfirmDialog.js.map