feat: toast package (#1073)

This commit is contained in:
Mo
2022-06-07 13:19:45 -05:00
committed by GitHub
parent de94fb69cf
commit 6d0b6e9018
27 changed files with 524 additions and 23 deletions

View File

@@ -0,0 +1,20 @@
import { FunctionComponent } from 'react'
import { useStore } from '@nanostores/react'
import { toastStore } from './toastStore'
import { ToastTimer } from './ToastTimer'
export const ToastContainer: FunctionComponent = () => {
const toasts = useStore(toastStore)
if (!toasts.length) {
return null
}
return (
<div className="flex flex-col items-end fixed z-index-toast bottom-6 right-6">
{toasts.map((toast, index) => (
<ToastTimer toast={toast} index={index} key={toast.id} />
))}
</div>
)
}