Use ES2015 classes instead of React.createClass.
Make Breadcrumb, Checkbox, Dropdown, Steps and Timeline components use ES2015 classes rather than React.createClass. This includes: * getDefaultProps method becomes a defaultProps value on the constructor. * propTypes becomes a value on the constructor.pull/1223/head
parent
90d899640a
commit
63c06e8652
@ -1,20 +1,19 @@
|
||||
import React from 'react';
|
||||
import Dropdown from 'rc-dropdown';
|
||||
import RcDropdown from 'rc-dropdown';
|
||||
|
||||
export default React.createClass({
|
||||
getDefaultProps() {
|
||||
return {
|
||||
transitionName: 'slide-up',
|
||||
prefixCls: 'ant-dropdown',
|
||||
};
|
||||
},
|
||||
export default class Dropdown extends React.Component {
|
||||
render() {
|
||||
const { overlay, ...otherProps } = this.props;
|
||||
const menu = React.cloneElement(overlay, {
|
||||
openTransitionName: 'zoom-big',
|
||||
});
|
||||
return (
|
||||
<Dropdown {...otherProps} overlay={menu} />
|
||||
<RcDropdown {...otherProps} overlay={menu} />
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Dropdown.defaultProps = {
|
||||
transitionName: 'slide-up',
|
||||
prefixCls: 'ant-dropdown',
|
||||
};
|
||||
|
@ -1,33 +1,30 @@
|
||||
import React from 'react';
|
||||
import Steps from 'rc-steps';
|
||||
import RcSteps from 'rc-steps';
|
||||
|
||||
const AntSteps = React.createClass({
|
||||
getDefaultProps() {
|
||||
return {
|
||||
prefixCls: 'ant-steps',
|
||||
iconPrefix: 'ant',
|
||||
maxDescriptionWidth: 100,
|
||||
current: 0
|
||||
};
|
||||
},
|
||||
export default class Steps extends React.Component {
|
||||
render() {
|
||||
let maxDescriptionWidth = this.props.maxDescriptionWidth;
|
||||
if (this.props.direction === 'vertical') {
|
||||
maxDescriptionWidth = 'auto';
|
||||
}
|
||||
return (
|
||||
<Steps size={this.props.size}
|
||||
<RcSteps size={this.props.size}
|
||||
current={this.props.current}
|
||||
direction={this.props.direction}
|
||||
iconPrefix={this.props.iconPrefix}
|
||||
maxDescriptionWidth={maxDescriptionWidth}
|
||||
prefixCls={this.props.prefixCls}>
|
||||
{this.props.children}
|
||||
</Steps>
|
||||
</RcSteps>
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
AntSteps.Step = Steps.Step;
|
||||
Steps.defaultProps = {
|
||||
prefixCls: 'ant-steps',
|
||||
iconPrefix: 'ant',
|
||||
maxDescriptionWidth: 100,
|
||||
current: 0
|
||||
};
|
||||
|
||||
export default AntSteps;
|
||||
Steps.Step = RcSteps.Step;
|
||||
|
Loading…
Reference in New Issue