Skip to content

Commit 3c686ae

Browse files
committed
fix es6 components
1 parent 78a157f commit 3c686ae

File tree

2 files changed

+32
-28
lines changed

2 files changed

+32
-28
lines changed

specs/button/Button.jsx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,12 @@ import s from './Button.css';
66
* The only true button.
77
*/
88
export default class Button extends Component {
9-
static propTypes = {
10-
/**
11-
* Button label.
12-
*/
13-
children: PropTypes.string.isRequired,
14-
color: PropTypes.string,
15-
size: PropTypes.oneOf(['small', 'normal', 'large']),
16-
}
17-
static defaultProps = {
18-
color: '#333',
19-
size: 'normal'
20-
}
21-
static sizes = {
22-
small: '10px',
23-
normal: '14px',
24-
large: '18px'
9+
constructor() {
10+
this.sizes = {
11+
small: '10px',
12+
normal: '14px',
13+
large: '18px'
14+
};
2515
}
2616

2717
onClick() {
@@ -39,3 +29,17 @@ export default class Button extends Component {
3929
);
4030
}
4131
}
32+
33+
Button.propTypes = {
34+
/**
35+
* Button label.
36+
*/
37+
children: PropTypes.string.isRequired,
38+
color: PropTypes.string,
39+
size: PropTypes.oneOf(['small', 'normal', 'large']),
40+
};
41+
42+
Button.defaultProps = {
43+
color: '#333',
44+
size: 'normal'
45+
};

specs/placeholder/Placeholder.jsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ import s from './Placeholder.css';
66
* Image placeholders.
77
*/
88
export default class Placeholder extends Component {
9-
static propTypes = {
10-
type: PropTypes.oneOf(['animal', 'bacon', 'beard', 'bear', 'cat', 'food', 'city', 'nature', 'people']),
11-
width: PropTypes.number,
12-
height: PropTypes.number
13-
}
14-
15-
static defaultProps = {
16-
type: 'animal',
17-
width: 150,
18-
height: 150
19-
}
20-
219
getImageUrl() {
2210
let { type, width, height } = this.props;
2311
let types = {
@@ -41,3 +29,15 @@ export default class Placeholder extends Component {
4129
);
4230
}
4331
}
32+
33+
Placeholder.propTypes = {
34+
type: PropTypes.oneOf(['animal', 'bacon', 'beard', 'bear', 'cat', 'food', 'city', 'nature', 'people']),
35+
width: PropTypes.number,
36+
height: PropTypes.number
37+
};
38+
39+
Placeholder.defaultProps = {
40+
type: 'animal',
41+
width: 150,
42+
height: 150
43+
};

0 commit comments

Comments
 (0)