index.js 576 B

1234567891011121314151617181920
  1. import React from 'react';
  2. import './index.less';
  3. function ProgressButton(props) {
  4. const { children, className = '', progress, width, onClick } = props;
  5. return (
  6. <div
  7. style={{ width: width || '' }}
  8. className={`progress-button ${className} ${progress > 0 ? 'theme' : 'default'}`}
  9. onClick={() => {
  10. if (onClick) onClick();
  11. }}
  12. >
  13. <div className="progress" style={{ width: `${progress}%` }} />
  14. <div className="progress-content">{children}</div>
  15. </div>
  16. );
  17. }
  18. ProgressButton.propTypes = {};
  19. export default ProgressButton;