Function
SpinnerWidget
({
id,
label = 'Loading...',
variant = 'default',
className,
showLabel = true,
})
Source from the content-addressed store, hash-verified
| 5 | import { cn } from '@/lib/utils'; |
| 6 | |
| 7 | const SpinnerWidget = ({ |
| 8 | id, |
| 9 | label = 'Loading...', |
| 10 | variant = 'default', |
| 11 | className, |
| 12 | showLabel = true, |
| 13 | }) => { |
| 14 | const SpinnerContent = ( |
| 15 | <div |
| 16 | id={variant !== 'card' ? id : undefined} |
| 17 | className={cn('flex flex-col items-center gap-2 p-4', className)} |
| 18 | > |
| 19 | <div className="h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" /> |
| 20 | {showLabel && label && <p className="text-sm text-muted-foreground">{label}</p>} |
| 21 | </div> |
| 22 | ); |
| 23 | |
| 24 | if (variant === 'card') { |
| 25 | return ( |
| 26 | <Card id={id}> |
| 27 | <CardContent>{SpinnerContent}</CardContent> |
| 28 | </Card> |
| 29 | ); |
| 30 | } |
| 31 | |
| 32 | return SpinnerContent; |
| 33 | }; |
| 34 | |
| 35 | export default SpinnerWidget; |
Callers
nothing calls this directly
Tested by
no test coverage detected