index.js 758 B

1234567891011121314151617181920212223242526272829303132
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. import Touch from '@src/containers/Touch';
  4. export default class Button extends Component {
  5. render() {
  6. const {
  7. className = '',
  8. width,
  9. margin,
  10. size = 'basic',
  11. theme = 'default',
  12. children,
  13. onClick,
  14. radius,
  15. block,
  16. } = this.props;
  17. return (
  18. <div
  19. className={`g-button-wrapper ${className} ${size} ${theme} ${radius ? 'radius' : ''} ${block ? 'block' : ''}`}
  20. >
  21. <Touch
  22. style={{ width: width || 'auto', margin: margin ? `0 ${margin}px` : '' }}
  23. className="g-button"
  24. onClick={() => onClick && onClick()}
  25. >
  26. {children}
  27. </Touch>
  28. </div>
  29. );
  30. }
  31. }