progress.tsx
609 bytes
| 1 | 'use client'; |
|---|---|
| 2 | |
| 3 | import * as React from 'react'; |
| 4 | import { cn } from '@/lib/utils'; |
| 5 | |
| 6 | /** Minimal determinate progress bar (0-100). */ |
| 7 | export function Progress({ |
| 8 | value = 0, |
| 9 | className, |
| 10 | indicatorClassName, |
| 11 | }: { |
| 12 | value?: number; |
| 13 | className?: string; |
| 14 | indicatorClassName?: string; |
| 15 | }) { |
| 16 | return ( |
| 17 | <div className={cn('relative h-2 w-full overflow-hidden rounded-full bg-secondary', className)}> |
| 18 | <div |
| 19 | className={cn('h-full rounded-full bg-primary transition-all duration-500', indicatorClassName)} |
| 20 | style={{ width: `${Math.max(0, Math.min(100, value))}%` }} |
| 21 | /> |
| 22 | </div> |
| 23 | ); |
| 24 | } |
| 25 | |