MCPcopy Create free account
hub / github.com/emwalker/digraph / Alert

Function Alert

client/src/components/FlashMessages/Alert/index.tsx:23–45  ·  view source on GitHub ↗
({ children, alert, onClose }: Props)

Source from the content-addressed store, hash-verified

21}
22
23export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected