index.tsx 469 B

12345678910111213141516171819202122232425
  1. import cn from '@/utils/classnames'
  2. type ProgressBarProps = {
  3. percent: number
  4. color: string
  5. }
  6. const ProgressBar = ({
  7. percent = 0,
  8. color = '#2970FF',
  9. }: ProgressBarProps) => {
  10. return (
  11. <div className='bg-components-progress-bar-bg rounded-[6px] overflow-hidden'>
  12. <div
  13. className={cn('h-1 rounded-[6px]', color)}
  14. style={{
  15. width: `${Math.min(percent, 100)}%`,
  16. }}
  17. />
  18. </div>
  19. )
  20. }
  21. export default ProgressBar