gitscope
← marzneshin / master / dashboard/src/common/components/ui/progress.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/common/components/ui/progress.tsx · TypeScript
Blame Raw
 1import * as React from "react"
 2import * as ProgressPrimitive from "@radix-ui/react-progress"
 3
 4import { cn } from "@marzneshin/common/utils"
 5
 6const Progress = React.forwardRef<
 7    React.ElementRef<typeof ProgressPrimitive.Root>,
 8    React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
 9>(({ className, value, ...props }, ref) => (
10    <ProgressPrimitive.Root
11        ref={ref}
12        className={cn(
13            "relative h-4 w-full overflow-hidden rounded-full bg-secondary",
14            className
15        )}
16        {...props}
17    >
18        <ProgressPrimitive.Indicator
19            className="h-full w-full flex-1 bg-primary transition-all"
20            style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
21        />
22    </ProgressPrimitive.Root>
23))
24Progress.displayName = ProgressPrimitive.Root.displayName
25
26export { Progress }