mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
314daf155e
* Added an UNSET sync mode * Fixed tests * Remove sync logs and adjusted dropdown * Fixed duplication kve bug * Added sync config modal * AUtobind * Autobind working * Hot loading works again * Remove express * Fixed tests * Fix one thing * Fixed some hmr-related bugs
64 lines
1.3 KiB
JavaScript
64 lines
1.3 KiB
JavaScript
import React, {PureComponent} from 'react';
|
|
import autobind from 'autobind-decorator';
|
|
import Modal from '../base/Modal';
|
|
import ModalBody from '../base/ModalBody';
|
|
import ModalHeader from '../base/ModalHeader';
|
|
import ModalFooter from '../base/ModalFooter';
|
|
|
|
@autobind
|
|
class AlertModal extends PureComponent {
|
|
constructor (props) {
|
|
super(props);
|
|
|
|
this.state = {
|
|
title: '',
|
|
message: '',
|
|
};
|
|
}
|
|
|
|
_setModalRef (m) {
|
|
this.modal = m;
|
|
}
|
|
|
|
_handleOk () {
|
|
this.hide();
|
|
this._okCallback();
|
|
};
|
|
|
|
hide () {
|
|
this.modal.hide();
|
|
}
|
|
|
|
show (options = {}) {
|
|
this.modal.show();
|
|
|
|
const {title, message} = options;
|
|
this.setState({title, message});
|
|
|
|
return new Promise(resolve => this._okCallback = resolve);
|
|
}
|
|
|
|
render () {
|
|
const {extraProps} = this.props;
|
|
const {message, title} = this.state;
|
|
|
|
return (
|
|
<Modal ref={this._setModalRef} closeOnKeyCodes={[13]} {...extraProps}>
|
|
<ModalHeader>{title || 'Uh Oh!'}</ModalHeader>
|
|
<ModalBody className="wide pad">
|
|
{message}
|
|
</ModalBody>
|
|
<ModalFooter>
|
|
<button className="btn" onClick={this._handleOk}>
|
|
Ok
|
|
</button>
|
|
</ModalFooter>
|
|
</Modal>
|
|
)
|
|
}
|
|
}
|
|
|
|
AlertModal.propTypes = {};
|
|
|
|
export default AlertModal;
|