Progress.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { FC } from 'react';
  2. import { makeStyles, useTheme } from '@material-ui/core';
  3. import { ProgressProps } from './Types';
  4. const getStyles = makeStyles(() => ({
  5. root: {
  6. height: 'auto',
  7. transform: 'scaleY(-1)',
  8. width: '100%',
  9. '& line': {
  10. transformOrigin: '10px 15px',
  11. },
  12. },
  13. }));
  14. const Progress: FC<ProgressProps> = props => {
  15. const classes = getStyles();
  16. const theme = useTheme();
  17. const { percent = 0, color = '#06F3AF' } = props;
  18. return (
  19. <svg
  20. className={classes.root}
  21. width="300"
  22. height="30"
  23. viewBox="0 0 300 30"
  24. fill="none"
  25. xmlns="http://www.w3.org/2000/svg"
  26. >
  27. <line
  28. x1={10}
  29. y1={15}
  30. x2={290}
  31. y2={15}
  32. vectorEffect="non-scaling-stroke"
  33. strokeWidth="12"
  34. stroke={theme.palette.attuGrey.main}
  35. strokeLinecap="round"
  36. />
  37. <line
  38. x1={10}
  39. y1={15}
  40. x2={290}
  41. y2={15}
  42. vectorEffect="non-scaling-stroke"
  43. transform={`scale(${percent}, 1)`}
  44. strokeWidth="12"
  45. stroke={color}
  46. strokeLinecap="round"
  47. />
  48. </svg>
  49. );
  50. };
  51. export default Progress;