npm.io
0.0.5 • Published 5 years ago

@opensrp/notifications

Licence
Apache-2.0
Version
0.0.5
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
33

Notifications

The package contains utility functions for displaying notifications

Installation

yarn add @opensrp/notifications

Usage

The following available functions support different types of notifications:

sendSuccessNotification: Used to display a success popup

sendInfoNotification: Used to display an information popup

sendWarningNotification: Used to display a warning popup

sendErrorNotification: Used to display an error popup

Each of these methods accepts the following arguments:

  1. message: string

This is the notification title and is required

  1. description: string

This is the content of the notification. It's optional. A blank body will be displayed if it's not provided.

Code examples
/**
 * antd notification popup.
 *
 * @param {user} user details object
 */
export const openNotification = (user: User): void => {
  sendSuccessNotification(`Welcome back, ${user.username}`, 'You have 8 new messages');
};