veza/apps/web/src/components/ui/loading-spinner.tsx

43 lines
883 B
TypeScript
Raw Normal View History

import { cn } from '@/lib/utils';
interface LoadingSpinnerProps {
size?: 'sm' | 'md' | 'lg';
className?: string;
text?: string;
}
export function LoadingSpinner({
size = 'md',
className,
text,
}: LoadingSpinnerProps) {
const sizeClasses = {
sm: 'h-4 w-4',
md: 'h-8 w-8',
lg: 'h-12 w-12',
};
return (
<div
className={cn(
'flex flex-col items-center justify-center min-h-[200px]',
2025-12-13 02:34:34 +00:00
className,
)}
>
<div
className={cn(
'animate-spin rounded-full border-2 border-gray-300 border-t-blue-600',
2025-12-13 02:34:34 +00:00
sizeClasses[size],
)}
2025-12-13 02:34:34 +00:00
role="status"
aria-label="Chargement en cours"
>
2025-12-13 02:34:34 +00:00
<span className="sr-only">Chargement...</span>
</div>
{text && (
2025-12-13 02:34:34 +00:00
<p className="mt-2 text-sm text-gray-600 dark:text-gray-400">{text}</p>
)}
</div>
);
}