progress.tsx 740 B

12345678910111213141516171819202122232425262728293031
  1. "use client"
  2. import * as React from "react"
  3. import * as ProgressPrimitive from "@radix-ui/react-progress"
  4. import { cn } from "@/lib/utils"
  5. function Progress({
  6. className,
  7. value,
  8. ...props
  9. }: React.ComponentProps<typeof ProgressPrimitive.Root>) {
  10. return (
  11. <ProgressPrimitive.Root
  12. data-slot="progress"
  13. className={cn(
  14. "bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",
  15. className
  16. )}
  17. {...props}
  18. >
  19. <ProgressPrimitive.Indicator
  20. data-slot="progress-indicator"
  21. className="bg-primary h-full w-full flex-1 transition-all"
  22. style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
  23. />
  24. </ProgressPrimitive.Root>
  25. )
  26. }
  27. export { Progress }