6.1.9 • Published 13 days ago

@meniga/notifications v6.1.9

Weekly downloads
-
License
MIT
Repository
-
Last release
13 days ago

@meniga/notifications

This package is used to display notifications to the user, for example whether an action that required server activity was successful or not. It uses a local store to keep track of notifications and event listeners to react to the changes.

The UI component that is used is NotificationBar from @meniga/ui, see possible props and modifiers here: https://developer.meniga.cloud/storybook/index.html?path=/story/alerts-notificationbar--default

Usage

  1. Use the NotificationsBar component in your app layout file, to position where the notification should be displayed.

Example:

import { NotificationsBar } from '@meniga/notifications'

(somewhere in your app layout)

<NotificationsBar />
  1. Import the 'showNotification' utility function from the package in order to show a notification (for example in an event handler when responding to a successful or a failed API request).

Params:

  • type string - type of notification to display, scan be 'info', 'positive', 'warning' or 'negative'.
  • text string - the text to display in the notification.
  • title string - an optional title to display in the notification (optional).
  • id string - a unique id for the notification (optional)
  • useTimeout boolean - whether or not to use a timeout to hide the notification (optional, default = true).
  • ui object - props to pass to NotificationBar component (optional).
import { showNotification } from '@meniga/notifications'

showNotification(type, text, icon, id, useTimeout, { ...ui })

If you set useTimeout as false, you have to specify a unique id for the notification, because the only way to dismiss the notification is to then use the hideNotification(id) method.

import { showNotification, hideNotification } from '@meniga/notifications'

const notificationId = 'my-unique-id'

showNotification(type, text, notificationId, false)
hideNotification(notificationId)
6.1.9

13 days ago

6.1.8

1 month ago

6.1.4

1 month ago

6.1.3-alpha.0

1 month ago

6.1.1-alpha.0

1 month ago

6.1.4-alpha.0

1 month ago

6.1.6

1 month ago

6.1.5

1 month ago

6.1.2-alpha.0

1 month ago

6.1.7

1 month ago

6.1.0

1 month ago

6.0.37-alpha.0

1 month ago

6.0.38-alpha.0

1 month ago

6.0.36-alpha.0

1 month ago

6.0.35-alpha.0

1 month ago

6.0.34-alpha.0

1 month ago

6.0.33-alpha.0

1 month ago

6.0.32-alpha.0

1 month ago

6.0.29-alpha.0

1 month ago

6.0.30-alpha.0

1 month ago

6.0.31-alpha.0

1 month ago

6.0.28-alpha.0

2 months ago

6.0.24-alpha.0

2 months ago

6.0.25-alpha.0

2 months ago

6.0.26-alpha.0

2 months ago

6.0.27-alpha.0

2 months ago

6.0.23-alpha.0

2 months ago

6.0.21-alpha.0

4 months ago

6.0.22-alpha.0

4 months ago

6.0.20-alpha.0

4 months ago

6.0.16-alpha.0

4 months ago

6.0.17-alpha.0

4 months ago

6.0.19-alpha.0

4 months ago

6.0.18-alpha.0

4 months ago

6.0.13-alpha.0

4 months ago

6.0.15-alpha.0

4 months ago

6.0.12

4 months ago

6.0.1-alpha.0

6 months ago

6.0.7-alpha.0

6 months ago

6.0.2-alpha.0

6 months ago

6.0.0

6 months ago

6.0.4

6 months ago

5.0.0-alpha.14901

6 months ago

6.0.3-alpha.0

6 months ago

5.0.0-alpha.14900

6 months ago

1.0.0-alpha.0

6 months ago

6.0.9-alpha.0

6 months ago