1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 08:28:11 +00:00
Files
seahub/frontend/src/components/dialog/common-operation-confirmation-dialog.js
Michael An 08abceb14b custom modal header close icon (#7240)
* seahub custom modal header

* add custom modal header

* special modal use custom close
2024-12-24 11:20:40 +08:00

46 lines
1.4 KiB
JavaScript

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalBody, ModalFooter, Button } from 'reactstrap';
import { gettext } from '../../utils/constants';
import SeahubModalHeader from '@/components/common/seahub-modal-header';
const propTypes = {
title: PropTypes.string.isRequired,
message: PropTypes.string.isRequired,
confirmBtnText: PropTypes.string,
executeOperation: PropTypes.func.isRequired,
toggleDialog: PropTypes.func.isRequired
};
class CommonOperationConfirmationDialog extends Component {
toggle = () => {
this.props.toggleDialog();
};
executeOperation = () => {
this.toggle();
this.props.executeOperation();
};
render() {
let { title, message, confirmBtnText } = this.props;
return (
<Modal isOpen={true} toggle={this.toggle}>
<SeahubModalHeader toggle={this.toggle}>{title}</SeahubModalHeader>
<ModalBody>
<p dangerouslySetInnerHTML={{ __html: message }}></p>
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.executeOperation}>{confirmBtnText || gettext('Confirm')}</Button>
</ModalFooter>
</Modal>
);
}
}
CommonOperationConfirmationDialog.propTypes = propTypes;
export default CommonOperationConfirmationDialog;