Skip to content

Commit deff1e7

Browse files
committed
add tab
1 parent 51905df commit deff1e7

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

src/components/Tab.js

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import React, { PropTypes } from 'react';
1+
import React, { PropTypes, Component } from 'react';
22
import { findDOMNode } from 'react-dom';
33
import cx from 'classnames';
44

5-
module.exports = React.createClass({
6-
displayName: 'Tab',
5+
class Tab extends Component {
76

8-
propTypes: {
7+
static propTypes = {
98
className: PropTypes.string,
109
id: PropTypes.string,
1110
focus: PropTypes.bool,
@@ -19,32 +18,30 @@ module.exports = React.createClass({
1918
PropTypes.object,
2019
PropTypes.string,
2120
]),
22-
},
21+
};
2322

24-
getDefaultProps() {
25-
return {
26-
focus: false,
27-
selected: false,
28-
id: null,
29-
panelId: null,
30-
activeTabClassName: 'ReactTabs__Tab--selected',
31-
disabledTabClassName: 'ReactTabs__Tab--disabled',
32-
};
33-
},
23+
static defaultProps = {
24+
focus: false,
25+
selected: false,
26+
id: null,
27+
panelId: null,
28+
activeTabClassName: 'ReactTabs__Tab--selected',
29+
disabledTabClassName: 'ReactTabs__Tab--disabled',
30+
};
3431

3532
componentDidMount() {
3633
this.checkFocus();
37-
},
34+
}
3835

3936
componentDidUpdate() {
4037
this.checkFocus();
41-
},
38+
}
4239

4340
checkFocus() {
4441
if (this.props.selected && this.props.focus) {
4542
findDOMNode(this).focus();
4643
}
47-
},
44+
}
4845

4946
render() {
5047
const {
@@ -81,5 +78,7 @@ module.exports = React.createClass({
8178
{children}
8279
</li>
8380
);
84-
},
85-
});
81+
}
82+
}
83+
84+
export default Tab;

0 commit comments

Comments
 (0)