infoalloggi-monorepo/apps/infoalloggi/src/components/ui/progress.tsx

30 lines
683 B
TypeScript
Raw Normal View History

2025-08-28 18:27:07 +02:00
import { Progress as ProgressPrimitive } from "radix-ui";
import type * as React from "react";
2025-08-04 17:45:44 +02:00
2025-08-28 18:27:07 +02:00
import { cn } from "~/lib/utils";
2025-08-04 17:45:44 +02:00
function Progress({
2025-08-28 18:27:07 +02:00
className,
value,
...props
2025-08-04 17:45:44 +02:00
}: React.ComponentProps<typeof ProgressPrimitive.Root>) {
2025-08-28 18:27:07 +02:00
return (
<ProgressPrimitive.Root
className={cn(
"bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",
className,
)}
2025-08-29 16:18:32 +02:00
data-slot="progress"
2025-08-28 18:27:07 +02:00
{...props}
>
<ProgressPrimitive.Indicator
className="bg-primary h-full w-full flex-1 transition-all"
2025-08-29 16:18:32 +02:00
data-slot="progress-indicator"
2025-08-28 18:27:07 +02:00
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
/>
</ProgressPrimitive.Root>
);
2025-08-04 17:45:44 +02:00
}
2025-08-28 18:27:07 +02:00
export { Progress };