mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
Merge pull request #1237 from waywardmonkeys/more-es2015-classes
Convert Popover & Spin to ES2015 classes.
This commit is contained in:
commit
79bfb5a993
@ -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: {}
|
||||
};
|
||||
|
@ -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']),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user