All files / src/components/ui ErrorMessage.tsx

100% Statements 32/32
100% Branches 1/1
100% Functions 1/1
100% Lines 32/32

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 331x 1x 1x 1x 1x 1x 1x 1x 1x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x  
import { Icon } from "@/components/ui/icons";
import { Button } from "@/components/ui/Button";
 
interface ErrorMessageProps {
  message?: string;
  title?: string;
  onRetry?: () => void;
}
 
export default function ErrorMessage({
  message = "An error occurred while loading this content",
  title = "Error",
  onRetry}: ErrorMessageProps) {
  return (
    <div className="bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6 text-center">
      <div className="text-red-600 dark:text-red-400 mb-3">
        <Icon name="alert-circle" className="w-12 h-12 mx-auto" />
      </div>
      <h3 className="text-lg font-semibold text-red-700 dark:text-red-300 mb-2">{title}</h3>
      <p className="text-red-600 dark:text-red-400 mb-4">{message}</p>
      {onRetry && (
        <Button
          onClick={onRetry}
          variant="danger"
          size="md"
        >
          Try Again
        </Button>
      )}
    </div>
  );
}