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.

54 lines
1.0 KiB

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