"use client";
import * as ProgressPrimitive from "@radix-ui/react-progress";

export function Progress({ value }: { value: number }) {
  const v = Math.max(0, Math.min(100, value));
  return (
    <ProgressPrimitive.Root className="relative h-2 w-full overflow-hidden rounded-full bg-neutral-200" value={v}>
      <ProgressPrimitive.Indicator
        className="h-full w-full origin-left rounded-full bg-neutral-900 transition-transform duration-500"
        style={{ transform: `translateX(-${100 - v}%)` }}
      />
    </ProgressPrimitive.Root>
  );
}
