progress.tsx 733 B

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