Skip to content

Commit de4e920

Browse files
committed
use class properties
1 parent 88e0905 commit de4e920

File tree

4 files changed

+31
-28
lines changed

4 files changed

+31
-28
lines changed

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ gulp.task('compile', function () {
1616
plugins: [
1717
'syntax-async-functions',
1818
'transform-async-to-generator',
19+
"transform-class-properties",
1920
'transform-runtime'
2021
]
2122
}))

lib/frame.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
import React, { PropTypes } from 'react';
22

33
export default class Frame extends React.Component {
4+
static propTypes = {
5+
children: PropTypes.arrayOf(PropTypes.element).isRequired,
6+
component: PropTypes.string,
7+
delay: PropTypes.number,
8+
onRender: PropTypes.func
9+
};
10+
11+
static defaultProps = {
12+
component: null,
13+
delay: 0,
14+
onRender: () => {}
15+
};
16+
417
componentDidMount () {
518
this.props.onRender();
619
}
@@ -14,16 +27,3 @@ export default class Frame extends React.Component {
1427
return React.createElement(component, null, this.props.children);
1528
}
1629
}
17-
18-
Frame.propTypes = {
19-
children: PropTypes.arrayOf(PropTypes.element).isRequired,
20-
component: PropTypes.string,
21-
delay: PropTypes.number,
22-
onRender: PropTypes.func
23-
};
24-
25-
Frame.defaultProps = {
26-
component: null,
27-
delay: 0,
28-
onRender: () => {}
29-
};

lib/keyframes.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ import React, { PropTypes } from 'react';
33
const noop = () => {};
44

55
export default class Keyframes extends React.Component {
6+
static propTypes = {
7+
children: PropTypes.arrayOf(PropTypes.element).isRequired,
8+
component: PropTypes.string,
9+
onStart: PropTypes.func,
10+
onEnd: PropTypes.func
11+
};
12+
13+
static defaultProps = {
14+
component: 'span',
15+
onStart: noop,
16+
onEnd: noop
17+
};
18+
619
constructor (props) {
720
super(props);
821
this.state = { frameNum: -1 };
@@ -68,16 +81,3 @@ export default class Keyframes extends React.Component {
6881
return this.props.children[frameNum];
6982
}
7083
}
71-
72-
Keyframes.propTypes = {
73-
children: PropTypes.arrayOf(PropTypes.element).isRequired,
74-
component: PropTypes.string,
75-
onStart: PropTypes.func,
76-
onEnd: PropTypes.func
77-
};
78-
79-
Keyframes.defaultProps = {
80-
component: 'span',
81-
onStart: noop,
82-
onEnd: noop
83-
};

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"babel-eslint": "5.0.0",
1515
"babel-plugin-syntax-async-functions": "6.5.0",
1616
"babel-plugin-transform-async-to-generator": "6.7.0",
17+
"babel-plugin-transform-class-properties": "6.6.0",
1718
"babel-plugin-transform-runtime": "6.6.0",
1819
"babel-preset-es2015": "6.6.0",
1920
"babel-preset-react": "6.5.0",
@@ -43,9 +44,10 @@
4344
"react"
4445
],
4546
"plugins": [
46-
"transform-runtime",
4747
"syntax-async-functions",
48-
"transform-async-to-generator"
48+
"transform-async-to-generator",
49+
"transform-class-properties",
50+
"transform-runtime"
4951
]
5052
},
5153
"ava": {

0 commit comments

Comments
 (0)