import React from 'react';
import { Loader2 } from 'lucide-react';

export interface LoaderProps {
  size?: 'sm' | 'md' | 'lg' | 'default';
  text?: string;
  className?: string;
}

const Loader: React.FC<LoaderProps> = ({ size = 'default', text, className = '' }) => {
  const sizeClasses = {
    sm: 'h-4 w-4',
    md: 'h-6 w-6',
    lg: 'h-8 w-8',
    default: 'h-10 w-10',
  };

  return (
    <div className={`flex flex-col items-center justify-center ${className}`}>
      <Loader2 className={`animate-spin text-primary ${sizeClasses[size]}`} />
      {text && <span className="mt-2 text-sm text-muted-foreground">{text}</span>}
    </div>
  );
};

export { Loader };