blob: 62733ab3cde3b477b9d2da85c45552052489e0d6 (
plain)
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
|
import { h, Fragment, VNode } from "preact";
import { Attention } from "./Attention.js";
import { Notification } from "../index.browser.js";
export function LocalNotificationBanner({ notification, showDebug }: { notification?: Notification, showDebug?: boolean }): VNode {
if (!notification) return <Fragment />
switch (notification.message.type) {
case "error":
return <div class="relative">
<div class="fixed top-0 left-0 right-0 z-20 w-full p-4">
<Attention type="danger" title={notification.message.title} onClose={() => {
notification.remove()
}}>
{notification.message.description &&
<div class="mt-2 text-sm text-red-700">
{notification.message.description}
</div>
}
{showDebug && <pre class="whitespace-break-spaces ">
{notification.message.debug}
</pre>}
</Attention>
</div>
</div>
case "info":
return <div class="relative">
<div class="fixed top-0 left-0 right-0 z-20 w-full p-4">
<Attention type="success" title={notification.message.title} onClose={() => {
notification.remove();
}} /></div></div>
}
}
|