diff --git a/components/breadcrumb/index.jsx b/components/breadcrumb/index.jsx
index 34982815f4..62dbb94d3a 100644
--- a/components/breadcrumb/index.jsx
+++ b/components/breadcrumb/index.jsx
@@ -1,20 +1,7 @@
import React, { cloneElement } from 'react';
-const BreadcrumbItem = React.createClass({
- getDefaultProps() {
- return {
- prefixCls: 'ant-breadcrumb',
- separator: '/',
- };
- },
- propTypes: {
- prefixCls: React.PropTypes.string,
- separator: React.PropTypes.oneOfType([
- React.PropTypes.string,
- React.PropTypes.element,
- ]),
- href: React.PropTypes.string,
- },
+/* Exported as Breadcrumb.Item */
+class BreadcrumbItem extends React.Component {
render() {
const { prefixCls, separator, children } = this.props;
let link = {children};
@@ -28,25 +15,23 @@ const BreadcrumbItem = React.createClass({
);
}
-});
+}
-const Breadcrumb = React.createClass({
- getDefaultProps() {
- return {
- prefixCls: 'ant-breadcrumb',
- separator: '/',
- linkRender: (href, name) => {name},
- };
- },
- propTypes: {
- prefixCls: React.PropTypes.string,
- separator: React.PropTypes.oneOfType([
- React.PropTypes.string,
- React.PropTypes.element,
- ]),
- routes: React.PropTypes.array,
- params: React.PropTypes.object,
- },
+BreadcrumbItem.defaultProps = {
+ prefixCls: 'ant-breadcrumb',
+ separator: '/',
+};
+
+BreadcrumbItem.propTypes = {
+ prefixCls: React.PropTypes.string,
+ separator: React.PropTypes.oneOfType([
+ React.PropTypes.string,
+ React.PropTypes.element,
+ ]),
+ href: React.PropTypes.string,
+};
+
+export default class Breadcrumb extends React.Component {
render() {
let crumbs;
const { separator, prefixCls, routes, params, children, linkRender } = this.props;
@@ -90,7 +75,22 @@ const Breadcrumb = React.createClass({
);
}
-});
+}
+
+Breadcrumb.defaultProps = {
+ prefixCls: 'ant-breadcrumb',
+ separator: '/',
+ linkRender: (href, name) => {name},
+};
+
+Breadcrumb.propTypes = {
+ prefixCls: React.PropTypes.string,
+ separator: React.PropTypes.oneOfType([
+ React.PropTypes.string,
+ React.PropTypes.element,
+ ]),
+ routes: React.PropTypes.array,
+ params: React.PropTypes.object,
+};
Breadcrumb.Item = BreadcrumbItem;
-export default Breadcrumb;
diff --git a/components/checkbox/index.jsx b/components/checkbox/index.jsx
index dca2cefda4..1c58d55d0e 100644
--- a/components/checkbox/index.jsx
+++ b/components/checkbox/index.jsx
@@ -3,12 +3,7 @@ import React from 'react';
import Group from './Group';
import classNames from 'classnames';
-const Checkbox = React.createClass({
- getDefaultProps() {
- return {
- prefixCls: 'ant-checkbox'
- };
- },
+export default class Checkbox extends React.Component {
render() {
const { prefixCls, style, children, className, ...restProps } = this.props;
const classString = classNames({
@@ -22,8 +17,10 @@ const Checkbox = React.createClass({
);
}
-});
+}
-Checkbox.Group = Group;
+Checkbox.defaultProps = {
+ prefixCls: 'ant-checkbox'
+};
-export default Checkbox;
+Checkbox.Group = Group;
diff --git a/components/dropdown/dropdown-button.jsx b/components/dropdown/dropdown-button.jsx
index 675f97c5c9..b25bd22e14 100644
--- a/components/dropdown/dropdown-button.jsx
+++ b/components/dropdown/dropdown-button.jsx
@@ -5,21 +5,7 @@ import Dropdown from './dropdown';
const ButtonGroup = Button.Group;
import classNames from 'classnames';
-export default React.createClass({
- getDefaultProps() {
- return {
- align: {
- points: ['tr', 'br'],
- overlay: {
- adjustX: 1,
- adjustY: 1,
- },
- offset: [0, 4],
- targetOffset: [0, 0],
- },
- type: 'default',
- };
- },
+export default class DropdownButton extends React.Component {
render() {
const { type, overlay, trigger, align, children, className, ...restProps } = this.props;
const cls = classNames({
@@ -37,4 +23,17 @@ export default React.createClass({
);
}
-});
+}
+
+DropdownButton.defaultProps = {
+ align: {
+ points: ['tr', 'br'],
+ overlay: {
+ adjustX: 1,
+ adjustY: 1,
+ },
+ offset: [0, 4],
+ targetOffset: [0, 0],
+ },
+ type: 'default',
+};
diff --git a/components/dropdown/dropdown.jsx b/components/dropdown/dropdown.jsx
index 8cb236f885..f767579dfc 100644
--- a/components/dropdown/dropdown.jsx
+++ b/components/dropdown/dropdown.jsx
@@ -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.defaultProps = {
+ transitionName: 'slide-up',
+ prefixCls: 'ant-dropdown',
+};
diff --git a/components/steps/index.jsx b/components/steps/index.jsx
index 937ddfbdf2..3b1e1cb8f7 100644
--- a/components/steps/index.jsx
+++ b/components/steps/index.jsx
@@ -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 (
-
{this.props.children}
-
+
);
}
-});
+}
-AntSteps.Step = Steps.Step;
+Steps.defaultProps = {
+ prefixCls: 'ant-steps',
+ iconPrefix: 'ant',
+ maxDescriptionWidth: 100,
+ current: 0
+};
-export default AntSteps;
+Steps.Step = RcSteps.Step;
diff --git a/components/timeline/index.jsx b/components/timeline/index.jsx
index 1c6b8765f6..eb5ef006d2 100644
--- a/components/timeline/index.jsx
+++ b/components/timeline/index.jsx
@@ -1,15 +1,8 @@
import React from 'react';
import classNames from 'classnames';
-const TimelineItem = React.createClass({
- getDefaultProps() {
- return {
- prefixCls: 'ant-timeline',
- color: 'blue',
- last: false,
- pending: false,
- };
- },
+/* Exported as Timeline.Item */
+class TimelineItem extends React.Component {
render() {
const { prefixCls, color, last, children, pending } = this.props;
const itemClassName = classNames({
@@ -25,14 +18,16 @@ const TimelineItem = React.createClass({
);
}
-});
+}
-const Timeline = React.createClass({
- getDefaultProps() {
- return {
- prefixCls: 'ant-timeline',
- };
- },
+TimelineItem.defaultProps = {
+ prefixCls: 'ant-timeline',
+ color: 'blue',
+ last: false,
+ pending: false,
+};
+
+export default class Timeline extends React.Component {
render() {
const { prefixCls, children, pending } = this.props;
const pendingNode = typeof pending === 'boolean' ? null : pending;
@@ -55,8 +50,10 @@ const Timeline = React.createClass({
);
}
-});
+}
-Timeline.Item = TimelineItem;
+Timeline.defaultProps = {
+ prefixCls: 'ant-timeline',
+};
-export default Timeline;
+Timeline.Item = TimelineItem;