0.0.2 • Published 2 years ago

@stefanprobst/notifications v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

notifications

How to use

import '@stefanprobst/notifications/notifications.css'
import '@stefanprobst/notifications/notification-message.css'

import {
  Announcer,
  createNotificationsStore,
  createNotify,
  NotificationMessage,
  Notifications,
  NotificationsProvider,
} from '@stefanprobst/notifications'

export const store = createNotificationsStore()

export const notify = createNotify(store)

export function NotificationsContainer() {
  return (
    <NotificationsProvider store={store}>
      {(notifications, store) => (
        <>
          <Notifications notifications={notifications} store={store}>
            {(notification) => <NotificationMessage notification={notification} store={store} />}
          </Notifications>
          <Announcer notifications={notifications} store={store}>
            {(notification) => <NotificationMessage notification={notification} store={store} />}
          </Announcer>
        </>
      )}
    </NotificationsProvider>
  )
}