({ children, alert, onClose }: Props)
| 21 | } |
| 22 | |
| 23 | export default function Alert({ children, alert, onClose }: Props) { |
| 24 | const alertClass = alertCasses[alert.type] || 'flash-success' |
| 25 | |
| 26 | const defaultOnClose = () => { |
| 27 | const removeAlert = window.flashMessages?.removeAlert |
| 28 | if (!removeAlert) return |
| 29 | removeAlert(alert.id) |
| 30 | } |
| 31 | |
| 32 | return ( |
| 33 | <div className={`flash fade in mt-3 mb-3 ${alertClass}`}> |
| 34 | <button |
| 35 | className="flash-close" |
| 36 | onClick={onClose || defaultOnClose} |
| 37 | type="button" |
| 38 | > |
| 39 | <GoX /> |
| 40 | </button> |
| 41 | { alert.text } |
| 42 | { children } |
| 43 | </div> |
| 44 | ) |
| 45 | } |
nothing calls this directly
no outgoing calls
no test coverage detected