import PropTypes from 'prop-types'; class Button extends React.PureComponent { constructor (props, context) { super(props, context); this.handleClick = this.handleClick.bind(this); } handleClick (e) { if (!this.props.disabled) { this.props.onClick(); } } render () { const style = { fontFamily: 'inherit', display: this.props.block ? 'block' : 'inline-block', width: this.props.block ? '100%' : 'auto', position: 'relative', boxSizing: 'border-box', textAlign: 'center', border: '10px none', fontSize: '14px', fontWeight: '500', letterSpacing: '0', padding: `0 ${this.props.size / 2.25}px`, height: `${this.props.size}px`, cursor: 'pointer', lineHeight: `${this.props.size}px`, borderRadius: '4px', textDecoration: 'none', whiteSpace: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden' }; return ( ); } } Button.propTypes = { text: PropTypes.node, onClick: PropTypes.func, disabled: PropTypes.bool, block: PropTypes.bool, secondary: PropTypes.bool, size: PropTypes.number, style: PropTypes.object, children: PropTypes.node }; Button.defaultProps = { size: 36 }; export default Button;