Convert Popover & Spin to ES2015 classes.

This commit is contained in:
Bruce Mitchener 2016-03-20 19:41:34 +07:00
parent a760e74734
commit 1b81aa8c75
2 changed files with 25 additions and 33 deletions

View File

@ -5,18 +5,7 @@ import getPlacements from './placements';
const placements = getPlacements();
const prefixCls = 'ant-popover';
const Popover = React.createClass({
getDefaultProps() {
return {
prefixCls,
placement: 'top',
trigger: 'hover',
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1,
overlayStyle: {}
};
},
export default class Popover extends React.Component {
render() {
const transitionName = ({
top: 'zoom-down',
@ -42,11 +31,11 @@ const Popover = React.createClass({
{this.props.children}
</Tooltip>
);
},
}
getPopupDomNode() {
return this.refs.tooltip.getPopupDomNode();
},
}
getOverlay() {
return (
@ -57,7 +46,14 @@ const Popover = React.createClass({
</div>
</div>
);
},
});
}
}
export default Popover;
Popover.defaultProps = {
prefixCls,
placement: 'top',
trigger: 'hover',
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1,
overlayStyle: {}
};

View File

@ -2,22 +2,10 @@ import React from 'react';
import classNames from 'classnames';
import { isCssAnimationSupported } from 'css-animation';
const AntSpin = React.createClass({
getDefaultProps() {
return {
prefixCls: 'ant-spin',
spining: true,
};
},
propTypes: {
className: React.PropTypes.string,
size: React.PropTypes.oneOf(['small', 'default', 'large']),
},
export default class Spin extends React.Component {
isNestedPattern() {
return !!(this.props && this.props.children);
},
}
render() {
const { className, size, prefixCls, tip } = this.props;
@ -56,6 +44,14 @@ const AntSpin = React.createClass({
}
return spinElement;
}
});
}
export default AntSpin;
Spin.defaultProps = {
prefixCls: 'ant-spin',
spining: true,
};
Spin.propTypes = {
className: React.PropTypes.string,
size: React.PropTypes.oneOf(['small', 'default', 'large']),
};