返回 presentation-ai
progress.tsx
根目录 / src / components / ui / progress.tsx
1 "use client";
2
3 import * as ProgressPrimitive from "@radix-ui/react-progress";
4 import * as React from "react";
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 >(({ className, value, ...props }, ref) => (
12 <ProgressPrimitive.Root
13 ref={ref}
14 className={cn(
15 "relative h-4 w-full overflow-hidden rounded-full bg-secondary",
16 className,
17 )}
18 {...props}
19 >
20 <ProgressPrimitive.Indicator
21 className="h-full w-full flex-1 bg-primary transition-all"
22 style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
23 />
24 </ProgressPrimitive.Root>
25 ));
26 Progress.displayName = ProgressPrimitive.Root.displayName;
27
28 export { Progress };
29
29 lines Plain Text