You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

53 lines
1.0 KiB

'use strict';
var React = require('react');
var Dialog = require('rc-dialog');
function noop() {
}
var Modal = React.createClass({
getInitialState() {
return {
visible: false
};
},
handleCancel() {
this.refs.d.requestClose();
},
getDefaultProps() {
return {
prefixCls: 'ant-modal',
onOk: noop,
onCancel: noop
};
},
show() {
this.setState({
visible: true
});
},
hide() {
this.setState({
visible: false
});
},
handleOk() {
this.props.onOk();
},
render() {
var props = this.props;
var footer = props.footer || [
<button type="button" className="ant-btn-default ant-btn" onClick={this.handleCancel}> </button>,
<button type="button" className="ant-btn-primary ant-btn" onClick={this.handleOk}> </button>
];
return <Dialog animation="zoom" onBeforeClose={props.onCancel} visible={this.state.visible} maskAnimation="fade" width="500" footer={footer} {...props} ref="d"/>;
}
});
module.exports = Modal;