({ message, onDismiss }: ErrorToastProps)
| 8 | } |
| 9 | |
| 10 | export function ErrorToast({ message, onDismiss }: ErrorToastProps) { |
| 11 | const handleKeyDown = (e: React.KeyboardEvent) => { |
| 12 | if (e.key === "Enter" || e.key === " " || e.key === "Escape") { |
| 13 | e.preventDefault() |
| 14 | onDismiss() |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | return ( |
| 19 | <div |
| 20 | role="alert" |
| 21 | aria-live="polite" |
| 22 | tabIndex={0} |
| 23 | onClick={onDismiss} |
| 24 | onKeyDown={handleKeyDown} |
| 25 | className="flex items-center gap-3 bg-card border border-border/50 px-4 py-3 rounded-xl shadow-sm cursor-pointer hover:bg-muted/50 focus:outline-none focus:ring-2 focus:ring-primary/50 transition-colors" |
| 26 | > |
| 27 | <div className="flex items-center justify-center w-8 h-8 rounded-full bg-destructive/10 flex-shrink-0"> |
| 28 | <svg |
| 29 | className="w-4 h-4 text-destructive" |
| 30 | viewBox="0 0 20 20" |
| 31 | fill="currentColor" |
| 32 | aria-hidden="true" |
| 33 | > |
| 34 | <path |
| 35 | fillRule="evenodd" |
| 36 | d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" |
| 37 | clipRule="evenodd" |
| 38 | /> |
| 39 | </svg> |
| 40 | </div> |
| 41 | <span className="text-sm text-foreground">{message}</span> |
| 42 | </div> |
| 43 | ) |
| 44 | } |
nothing calls this directly
no outgoing calls
no test coverage detected