| 1 | 'use client' |
| 2 | |
| 3 | import * as ProgressPrimitive from '@radix-ui/react-progress' |
| 4 | import * as React from 'react' |
| 5 | |
| 6 | import { cn } from '@/utils/className' |
| 7 | |
| 8 | interface ProgressProps extends React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> { |
| 9 | indicatorClassName?: string |
| 10 | } |
| 11 | |
| 12 | const Progress = React.forwardRef< |
| 13 | React.ElementRef<typeof ProgressPrimitive.Root>, |
| 14 | ProgressProps |
| 15 | >(({ className, indicatorClassName, value, ...props }, ref) => ( |
| 16 | <ProgressPrimitive.Root |
| 17 | ref={ref} |
| 18 | className={cn('relative h-2 w-full overflow-hidden rounded-full bg-primary/20', className)} |
| 19 | {...props} |
| 20 | > |
| 21 | <ProgressPrimitive.Indicator |
| 22 | className={cn('h-full w-full flex-1 bg-primary transition-all', indicatorClassName)} |
| 23 | style={{ transform: `translateX(-${100 - (value || 0)}%)` }} |
| 24 | /> |
| 25 | </ProgressPrimitive.Root> |
| 26 | )) |
| 27 | Progress.displayName = ProgressPrimitive.Root.displayName |
| 28 | |
| 29 | export { Progress } |
| 30 |