ant-design/components/modal/index.jsx
2015-06-12 12:01:02 +08:00

37 lines
800 B
JavaScript

'use strict';
var React = require('react');
var Dialog = require('rc-dialog');
function noop() {
}
var Modal = React.createClass({
handleCancel() {
this.refs.d.requestClose();
},
getDefaultProps() {
return {
prefixCls: 'ant-modal',
onOk: noop,
onCancel: noop,
onBeforeClose: noop
};
},
handleOk() {
this.props.onOk();
},
render() {
var props = this.props;
var 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" maskAnimation="fade" width="500" footer={footer} {...props} ref="d"/>;
}
});
module.exports = Modal;