Move button to its own component
fix css linting errors
This commit is contained in:
23
src/components/Button/Button.js
Normal file
23
src/components/Button/Button.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
import withStyles from 'isomorphic-style-loader/lib/withStyles';
|
||||
import s from './Button.css';
|
||||
|
||||
class Button extends React.Component {
|
||||
static propTypes = {
|
||||
children: PropTypes.node,
|
||||
onClick: PropTypes.func,
|
||||
};
|
||||
|
||||
handleClick = (event) => {
|
||||
if (this.props.onClick) {
|
||||
this.props.onClick(event);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { children, ...props } = this.props;
|
||||
return <button className={s.root} {...props} onClick={this.handleClick}>{children}</button>;
|
||||
}
|
||||
}
|
||||
|
||||
export default withStyles(s)(Button);
|
||||
Reference in New Issue
Block a user