Spaces:
Sleeping
Sleeping
File size: 792 Bytes
6242ddb | 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 | import { AlertCircle, CheckCircle, AlertTriangle, Info } from 'lucide-react';
interface AlertProps {
type: 'success' | 'danger' | 'warning' | 'info';
message: string;
onDismiss?: () => void;
}
const icons = {
success: CheckCircle,
danger: AlertCircle,
warning: AlertTriangle,
info: Info,
};
export function Alert({ type, message, onDismiss }: AlertProps) {
const Icon = icons[type];
return (
<div className={`alert alert-${type}`} role="alert">
<Icon size={16} />
<span style={{ flex: 1 }}>{message}</span>
{onDismiss && (
<button
onClick={onDismiss}
className="btn-icon"
style={{ border: 'none', padding: 4 }}
aria-label="Dismiss"
>
×
</button>
)}
</div>
);
}
|