forked from riccardoperra/codeimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnackbarHost.tsx
More file actions
39 lines (35 loc) · 899 Bytes
/
SnackbarHost.tsx
File metadata and controls
39 lines (35 loc) · 899 Bytes
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
34
35
36
37
38
39
import {Component} from 'solid-js';
import {toast as $toast, Toaster as ToasterV2, ToastHandler} from 'solid-toast';
import {AugmentedToastHandler, createPatch} from './patch-solid-toast';
import * as styles from './Snackbar.css';
export interface SnackbarData {
message: string | Component;
closeable?: boolean;
actions?: Component;
wrapper?: Component;
}
let toast: {
success: AugmentedToastHandler;
error: AugmentedToastHandler;
custom: typeof $toast['custom'];
default: ToastHandler;
remove: typeof $toast['remove'];
};
export function SnackbarHost() {
toast = {
success: createPatch($toast, 'success'),
error: createPatch($toast, 'error'),
custom: $toast.custom,
default: $toast,
remove: $toast.remove,
};
return (
<ToasterV2
toastOptions={{
className: styles.snackbar,
style: {},
}}
/>
);
}
export {toast};