mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 15:43:49 +01:00
Allow notifications to be dismissed by clicking
This commit is contained in:
parent
772317a4f1
commit
c445df4168
@ -19,16 +19,17 @@ export function SnackbarProvider(props: IProps): React.ReactElement {
|
||||
export const SnackbarEvents = new EventEmitter<[string, "success" | "warning" | "error" | "info", number]>();
|
||||
|
||||
export function Snackbar(): React.ReactElement {
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
|
||||
|
||||
useEffect(() =>
|
||||
SnackbarEvents.subscribe((s, variant, duration) =>
|
||||
enqueueSnackbar(<Alert severity={variant}>{s}</Alert>, {
|
||||
SnackbarEvents.subscribe((s, variant, duration) => {
|
||||
const id = enqueueSnackbar(<Alert severity={variant}>{s}</Alert>, {
|
||||
content: (k, m) => <Paper key={k}>{m}</Paper>,
|
||||
variant: variant,
|
||||
autoHideDuration: duration,
|
||||
}),
|
||||
),
|
||||
onClick: () => closeSnackbar(id),
|
||||
})
|
||||
}),
|
||||
);
|
||||
return <></>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user