diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..d3c57b2 --- /dev/null +++ b/.babelrc @@ -0,0 +1,13 @@ +{ + "env": { + "development": { + "presets": [ + "react-hmre" + ] + } + }, + "presets": [ + "es2015", + "react" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index fbdb621..7dee243 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.2.0", + "version": "0.3.0", "author": { "name": "Robert Haritonov", "url": "http://rhr.me/" @@ -11,10 +11,14 @@ "postinstall": "node pre-build-production.js" }, "dependencies": { + "babel-preset-es2015": "^6.9.0", + "babel-preset-react": "^6.5.0", + "babel-preset-react-hmre": "^1.1.1", + "babel-standalone": "^6.7.7", "react": "^0.14.2", "react-dom": "^0.14.2", "sourcejs": "^0.6.0-nightly.4", "sourcejs-react-docgen": "^0.3.0", - "sourcejs-react-styleguidist": "^0.4.0" + "sourcejs-react-styleguidist": "^0.5.0" } } diff --git a/specs/button/Button.jsx b/specs/button/Button.jsx index 03e57ae..1621925 100644 --- a/specs/button/Button.jsx +++ b/specs/button/Button.jsx @@ -6,22 +6,14 @@ import s from './Button.css'; * The only true button. */ export default class Button extends Component { - static propTypes = { - /** - * Button label. - */ - children: PropTypes.string.isRequired, - color: PropTypes.string, - size: PropTypes.oneOf(['small', 'normal', 'large']), - } - static defaultProps = { - color: '#333', - size: 'normal' - } - static sizes = { - small: '10px', - normal: '14px', - large: '18px' + constructor(props) { + super(props); + + this.sizes = { + small: '10px', + normal: '14px', + large: '18px' + }; } onClick() { @@ -31,7 +23,7 @@ export default class Button extends Component { render() { let styles = { color: this.props.color, - fontSize: Button.sizes[this.props.size] + fontSize: this.sizes[this.props.size] }; return ( @@ -39,3 +31,17 @@ export default class Button extends Component { ); } } + +Button.propTypes = { + /** + * Button label. + */ + children: PropTypes.string.isRequired, + color: PropTypes.string, + size: PropTypes.oneOf(['small', 'normal', 'large']), +}; + +Button.defaultProps = { + color: '#333', + size: 'normal' +}; diff --git a/specs/placeholder/Placeholder.jsx b/specs/placeholder/Placeholder.jsx index 009505b..48b8908 100644 --- a/specs/placeholder/Placeholder.jsx +++ b/specs/placeholder/Placeholder.jsx @@ -6,16 +6,8 @@ import s from './Placeholder.css'; * Image placeholders. */ export default class Placeholder extends Component { - static propTypes = { - type: PropTypes.oneOf(['animal', 'bacon', 'beard', 'bear', 'cat', 'food', 'city', 'nature', 'people']), - width: PropTypes.number, - height: PropTypes.number - } - - static defaultProps = { - type: 'animal', - width: 150, - height: 150 + constructor(props) { + super(props); } getImageUrl() { @@ -41,3 +33,15 @@ export default class Placeholder extends Component { ); } } + +Placeholder.propTypes = { + type: PropTypes.oneOf(['animal', 'bacon', 'beard', 'bear', 'cat', 'food', 'city', 'nature', 'people']), + width: PropTypes.number, + height: PropTypes.number +}; + +Placeholder.defaultProps = { + type: 'animal', + width: 150, + height: 150 +}; \ No newline at end of file