You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2 KiB

  1. import PureRenderMixin from 'react-addons-pure-render-mixin';
  2. const Button = React.createClass({
  3. propTypes: {
  4. text: React.PropTypes.string,
  5. onClick: React.PropTypes.func,
  6. disabled: React.PropTypes.bool,
  7. block: React.PropTypes.bool,
  8. secondary: React.PropTypes.bool
  9. },
  10. mixins: [PureRenderMixin],
  11. handleClick (e) {
  12. if (!this.props.disabled) {
  13. this.props.onClick();
  14. }
  15. },
  16. render () {
  17. const style = {
  18. fontFamily: 'Roboto',
  19. display: this.props.block ? 'block' : 'inline-block',
  20. width: this.props.block ? '100%' : 'auto',
  21. position: 'relative',
  22. boxSizing: 'border-box',
  23. textAlign: 'center',
  24. border: '10px none',
  25. color: '#fff',
  26. fontSize: '14px',
  27. fontWeight: '500',
  28. letterSpacing: '0',
  29. textTransform: 'uppercase',
  30. padding: '0 16px',
  31. height: '36px',
  32. cursor: 'pointer',
  33. lineHeight: '36px',
  34. borderRadius: '4px',
  35. textDecoration: 'none'
  36. };
  37. return (
  38. <button className={`button ${this.props.secondary ? 'button-secondary' : ''}`} disabled={this.props.disabled} onClick={this.handleClick} style={style}>
  39. {this.props.text || this.props.children}
  40. </button>
  41. );
  42. }
  43. });
  44. export default Button;