Skip to main content

GMFYNotifications

import { GMFYNotifications } from 'gmfy-sdk'

Motivation

Provider component for working with the list of user notifications with userId. It allows you to either get the list using hook. Or you can pass the ID of the node where notifications will be displayed.

Properties

type GMFYNotificationsProps = {
notificationClassName?: string;
maxNumberToVisible?: number;
config?: {
updateInterval?: number;
portalId?: string;
showNotifications?: boolean;
};
}
  • notificationClassName - the name of the style class that will be assigned to each of the notification cards
  • maxNumberToVisible - the maximum number of notification cards displayed at a time
  • maxNumberToVisible - provider settings object
    • updateInterval - query call frequency in ms. If 0, then the request will be executed only once. Default 0
    • portalId - ID of the element in which to create a portal with a list of notifications. If no element with that ID is passed or found, then document.body is selected
    • showNotifications - a flag responsible for whether received notifications will be displayed. Default false

Usage

<GMFYProvider config={config}>
<GMFYNotifications
showNotifications
maxNumberToVisible={4}
updateInterval={5000}
portalId="notifications-portal"
>
{/* your application */}
</GMFYNotifications>
</GMFYProvider>;

Display

card.png

The notification card displays

  • information message
  • icon to close the notification