1.0.8 • Published 2 years ago

@magicdidac/notifications v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago