detect system theme, toast performance opt.

This commit is contained in:
2023-08-01 11:52:50 +02:00
parent 13dd9526e2
commit 4bc5e5e1c7
8 changed files with 71 additions and 49 deletions

View File

@@ -3,17 +3,17 @@ import { useRecoilState } from 'recoil'
import { toastListState } from '../atoms/toast'
export const useToast = () => {
const [toasts, setToasts] = useRecoilState(toastListState)
const [, setToasts] = useRecoilState(toastListState)
return {
pushMessage: (message: string, severity?: AlertColor) => {
setToasts([{
setToasts(state => [...state, {
open: true,
message: message,
severity: severity,
autoClose: true,
createdAt: Date.now()
}, ...toasts])
}])
}
}
}