import React from 'react'; import { Loader2 } from 'lucide-react'; import { __ } from '@/lib/i18n'; interface LoadingStateProps { message?: string; size?: 'sm' | 'md' | 'lg'; fullScreen?: boolean; className?: string; } /** * Global Loading State Component * * Consistent loading UI across the application * - i18n support * - Responsive sizing * - Full-screen or inline mode * - Customizable message * * @example * // Default loading * * * // Custom message * * * // Full screen * * * // Small inline * */ export function LoadingState({ message, size = 'md', fullScreen = false, className = '' }: LoadingStateProps) { const sizeClasses = { sm: 'w-4 h-4', md: 'w-8 h-8', lg: 'w-12 h-12' }; const textSizeClasses = { sm: 'text-xs', md: 'text-sm', lg: 'text-base' }; const containerClasses = fullScreen ? 'fixed inset-0 flex items-center justify-center bg-background/80 backdrop-blur-sm z-50' : 'flex items-center justify-center p-8'; return (

{message || __('Loading...')}

); } /** * Page Loading State * Optimized for full page loads */ export function PageLoadingState({ message }: { message?: string }) { return ; } /** * Inline Loading State * For loading within components */ export function InlineLoadingState({ message }: { message?: string }) { return ; } /** * Card Loading Skeleton * For loading card content */ export function CardLoadingSkeleton() { return (
); } /** * Table Loading Skeleton * For loading table rows */ export function TableLoadingSkeleton({ rows = 5 }: { rows?: number }) { return (
{Array.from({ length: rows }).map((_, i) => (
))}
); }