import { Duration, TranslatedString, assertUnreachable } from "@gnu-taler/taler-util"; import { ComponentChildren, Fragment, VNode, h } from "preact"; interface Props { type?: "info" | "success" | "warning" | "danger" | "low", onClose?: () => void, title: TranslatedString, children?: ComponentChildren, timeout?: Duration, } export function Attention({ type = "info", title, children, onClose, timeout = Duration.getForever() }: Props): VNode { return
{timeout.d_ms === "forever" ? undefined : }
{type === "low" ? undefined : {(() => { switch (type) { case "info": return case "warning": return case "danger": return case "success": return default: assertUnreachable(type) } })()} }

{title}

{children}
{onClose &&
}
{timeout.d_ms === "forever" ? undefined :
}
}