loading_indicator.js 777 B

1234567891011121314151617181920212223242526272829303132
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. export const CircularProgress = ({ size, strokeWidth }) => {
  4. const viewBox = `0 0 ${size} ${size}`;
  5. const radius = (size - strokeWidth) / 2;
  6. return (
  7. <svg width={size} height={size} viewBox={viewBox} className='circular-progress' role='progressbar'>
  8. <circle
  9. fill='none'
  10. cx={size / 2}
  11. cy={size / 2}
  12. r={radius}
  13. strokeWidth={`${strokeWidth}px`}
  14. />
  15. </svg>
  16. );
  17. };
  18. CircularProgress.propTypes = {
  19. size: PropTypes.number.isRequired,
  20. strokeWidth: PropTypes.number.isRequired,
  21. };
  22. const LoadingIndicator = () => (
  23. <div className='loading-indicator'>
  24. <CircularProgress size={50} strokeWidth={6} />
  25. </div>
  26. );
  27. export default LoadingIndicator;