@nteract/mythic-notifications

A notification system based on blueprintjs toasters and the myths redux framework

Usage no npm install needed!

<script type="module">
  import nteractMythicNotifications from 'https://cdn.skypack.dev/@nteract/mythic-notifications';
</script>

README

@nteract/mythic-notifications

This package implements a notification system based on blueprintjs, using the myths framework.

Installation

$ yarn add @nteract/mythic-notifications
$ npm install --save @nteract/mythic-notifications

Usage

Initialize the package by including the notifications package in your store and rendering the <NotificationsRoot/>:

import { notifications, NotificationRoot } from "@nteract/mythic-notifications";
import { makeConfigureStore } from "@nteract/myths";

export const configureStore = makeConfigureStore({
  packages: [notifications],
});

export const App = () =>
    <>
      {/* ... */}
      <NotificationRoot darkTheme={false} />
    </>

Then dispatch actions made by sendNotification.create:

import { sendNotification } from "@nteract/mythic-notifications";

store.dispatch(sendNotification.create({
  title: "Hello World!",
  message: <em>Hi out there!</em>,
  level: "info",
}));

API

import { IconName } from "@blueprintjs/core";

export interface NotificationMessage {
  key?: string;
  icon?: IconName;
  title?: string;
  message: string | JSX.Element;
  level: "error" | "warning" | "info" | "success" | "in-progress";
  action?: {
    icon?: IconName;
    label: string;
    callback: () => void;
  };
}

Support

If you experience an issue while using this package or have a feature request, please file an issue on the issue board and add the pkg:mythic-notifications label.

License

BSD-3-Clause