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