30 lines
889 B
JavaScript
30 lines
889 B
JavaScript
|
"use client";
|
||
|
|
||
|
import React, { useContext } from 'react';
|
||
|
import ActionButton from '../../_util/ActionButton';
|
||
|
import { ModalContext } from '../context';
|
||
|
const ConfirmCancelBtn = () => {
|
||
|
const {
|
||
|
autoFocusButton,
|
||
|
cancelButtonProps,
|
||
|
cancelTextLocale,
|
||
|
isSilent,
|
||
|
mergedOkCancel,
|
||
|
rootPrefixCls,
|
||
|
close,
|
||
|
onCancel,
|
||
|
onConfirm
|
||
|
} = useContext(ModalContext);
|
||
|
return mergedOkCancel ? /*#__PURE__*/React.createElement(ActionButton, {
|
||
|
isSilent: isSilent,
|
||
|
actionFn: onCancel,
|
||
|
close: function () {
|
||
|
close === null || close === void 0 ? void 0 : close.apply(void 0, arguments);
|
||
|
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(false);
|
||
|
},
|
||
|
autoFocus: autoFocusButton === 'cancel',
|
||
|
buttonProps: cancelButtonProps,
|
||
|
prefixCls: `${rootPrefixCls}-btn`
|
||
|
}, cancelTextLocale) : null;
|
||
|
};
|
||
|
export default ConfirmCancelBtn;
|