index.js 828 B

1234567891011121314151617181920212223242526272829303132333435
  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. disabled,
  17. } = this.props;
  18. return (
  19. <div
  20. className={`g-button-wrapper ${className} ${size} ${theme} ${radius ? 'radius' : ''} ${block ? 'block' : ''} ${
  21. disabled ? 'disabled' : ''
  22. }`}
  23. onClick={() => onClick && onClick()}
  24. >
  25. <Touch
  26. style={{ width: width || 'auto', margin: margin ? `0 ${margin}px` : '0 auto' }}
  27. className="g-button"
  28. >
  29. {children}
  30. </Touch>
  31. </div>
  32. );
  33. }
  34. }