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