Skip to content

Commit 7dcf4bc

Browse files
committed
Merge pull request #1 from sourcejs/dev
Update example bundle based on latest sourcejs-react-styleguidist changes
2 parents 78a157f + c711cc0 commit 7dcf4bc

File tree

4 files changed

+56
-29
lines changed

4 files changed

+56
-29
lines changed

.babelrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"env": {
3+
"development": {
4+
"presets": [
5+
"react-hmre"
6+
]
7+
}
8+
},
9+
"presets": [
10+
"es2015",
11+
"react"
12+
]
13+
}

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.2.0",
2+
"version": "0.3.0",
33
"author": {
44
"name": "Robert Haritonov",
55
"url": "http://rhr.me/"
@@ -11,10 +11,14 @@
1111
"postinstall": "node pre-build-production.js"
1212
},
1313
"dependencies": {
14+
"babel-preset-es2015": "^6.9.0",
15+
"babel-preset-react": "^6.5.0",
16+
"babel-preset-react-hmre": "^1.1.1",
17+
"babel-standalone": "^6.7.7",
1418
"react": "^0.14.2",
1519
"react-dom": "^0.14.2",
1620
"sourcejs": "^0.6.0-nightly.4",
1721
"sourcejs-react-docgen": "^0.3.0",
18-
"sourcejs-react-styleguidist": "^0.4.0"
22+
"sourcejs-react-styleguidist": "^0.5.0"
1923
}
2024
}

specs/button/Button.jsx

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,14 @@ 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(props) {
10+
super(props);
11+
12+
this.sizes = {
13+
small: '10px',
14+
normal: '14px',
15+
large: '18px'
16+
};
2517
}
2618

2719
onClick() {
@@ -31,11 +23,25 @@ export default class Button extends Component {
3123
render() {
3224
let styles = {
3325
color: this.props.color,
34-
fontSize: Button.sizes[this.props.size]
26+
fontSize: this.sizes[this.props.size]
3527
};
3628

3729
return (
3830
<button className={s.root} style={styles} onClick={this.onClick}>{this.props.children}</button>
3931
);
4032
}
4133
}
34+
35+
Button.propTypes = {
36+
/**
37+
* Button label.
38+
*/
39+
children: PropTypes.string.isRequired,
40+
color: PropTypes.string,
41+
size: PropTypes.oneOf(['small', 'normal', 'large']),
42+
};
43+
44+
Button.defaultProps = {
45+
color: '#333',
46+
size: 'normal'
47+
};

specs/placeholder/Placeholder.jsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,8 @@ 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
9+
constructor(props) {
10+
super(props);
1911
}
2012

2113
getImageUrl() {
@@ -41,3 +33,15 @@ export default class Placeholder extends Component {
4133
);
4234
}
4335
}
36+
37+
Placeholder.propTypes = {
38+
type: PropTypes.oneOf(['animal', 'bacon', 'beard', 'bear', 'cat', 'food', 'city', 'nature', 'people']),
39+
width: PropTypes.number,
40+
height: PropTypes.number
41+
};
42+
43+
Placeholder.defaultProps = {
44+
type: 'animal',
45+
width: 150,
46+
height: 150
47+
};

0 commit comments

Comments
 (0)