Spaces:
Running
Running
File size: 1,086 Bytes
869a182 25c879d 869a182 25c879d 869a182 25c879d 869a182 25c879d 869a182 25c879d 869a182 25c879d |
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import React from "react";
interface ErrorMessageProps {
message: string | null;
onClose?: () => void;
className?: string;
}
export function ErrorMessage({
message,
onClose,
className = "",
}: ErrorMessageProps) {
if (!message) return null;
return (
<div
className={`p-2 bg-red-600/20 text-red-200 text-sm text-center relative ${className}`}
>
{onClose && (
<button
onClick={onClose}
className="absolute right-2 top-1/2 -translate-y-1/2 text-red-200 hover:text-white"
aria-label="Close error message"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
)}
{message}
</div>
);
}
|