1.0.8 • Published 9 months ago

@magicdidac/notifications v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@magicdidac/notifications

This is a package to be able to use notifications in any react application.

Install

With npm

npm i @magicdidac/notifications

With yarn

yarn add @magicdidac/notifications

Examples

These are some examples of the four types of notification.

screenshoot

How to use

NotificationProvider

index.tsx

import {NotificationProvider} from '@magicdidac/notifications'
...
<React.StrictMode>
  <NotificationProvider>
    <App />
  </NotificationProvider>
</React.StrictMode>
...

Properties

PropertyDescriptionDefaultValues
positionXThe horizontal position where the notifications will be shownPositionX.rightPositionX.left | PositionX.center | PositionX.right
postionYThe vertical position where the notifications will be shownPositionY.bottomPositionY.top | PositionY.bottom
widthThe width of the notifications400pxstring

useNotifications

This is a hook to invoke notifications

import { useNotifications } from '@magicdidac/notification'
...
const notifications = useNotifications()
...
return (
 <button onClick={() => notifications.success("Working!")}>Click Me!</button>
)
...

Functions

Every function has the same parameters | Parameter | Description | Optional | Default | |-------------------|--------------------------------------------------------------------|----------|---------| | message | The message to show | No | | | options.autoClose | Set to true to close the notification automatically over 5 seconds | Yes | true |

These are all the functions

FunctionExample
.successsuccess
.errorerror
.warningwarning
.infoinfo
1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago