react-notifier-system
Advanced tools
+77
| # React Notifier System | ||
| [](https://badge.fury.io/js/react-notifier-system) [](https://david-dm.org/sheikhG1900/react-notifier-system) [](https://david-dm.org/sheikhG1900/react-notifier-system#info=devDependencies) [](https://travis-ci.org/SheikhG1900/react-notifier-system) [](https://coveralls.io/github/SheikhG1900/react-notifier-system?branch=master) | ||
| > An extension of [react-notification-system](https://github.com/igorprado/react-notification-system) for showing notifications with much simpler approach. | ||
| <a href="https://igorprado.github.io/react-notification-system/"><img width="728" src="https://github.com/igorprado/react-notification-system/raw/master/example/src/images/screenshot.jpg" alt="Screenshot"></a> | ||
| ## Installing | ||
| ``` | ||
| npm install react-notifier-system | ||
| ``` | ||
| ### Important | ||
| For complete documentation, please go to [react-notification-system](https://github.com/igorprado/react-notification-system). | ||
| ## Using | ||
| For optimal appearance, this component **must be rendered on a top level HTML element** in your application to avoid position conflicts. | ||
| ```js | ||
| import * as React from 'react' | ||
| import Notifier from 'react-notifier-system' | ||
| const App = class extends React.Component<{}> { | ||
| addOrUpdateMyNotification = () => this.notifier.showNotification({ | ||
| message: 'My Notification', | ||
| level: 'info', | ||
| title: 'My Notification Title', | ||
| id: 'mynotification', | ||
| }) | ||
| addNotification = () => this.notifier.showNotification({ | ||
| message: 'New Notification', | ||
| level: 'info', | ||
| title: 'New Notification Title', | ||
| }) | ||
| removeMyNotification = () => this.notifier.removeNotificationById('mynotification') | ||
| notifier: any | ||
| render() { | ||
| return ( | ||
| <div> | ||
| <Notifier ref={notifier => this.notifier = notifier} /> | ||
| <button onClick={this.addOrUpdateMyNotification}>Add or update my notification</button> | ||
| <button onClick={this.removeMyNotification}>Remove my notification</button> | ||
| <button onClick={this.addNotification}>Add new notification</button> | ||
| </div> | ||
| ) | ||
| } | ||
| } | ||
| ReactDOM.render( | ||
| React.createElement(App), | ||
| document.getElementById('app') | ||
| ); | ||
| ``` | ||
| ## Methods | ||
| ### `showNotification(notification)` | ||
| Add or update a notification object. This displays the notification based on the [object](https://github.com/igorprado/react-notification-system#creating-a-notification) you passed. | ||
| It updates the notification if save `id`' found in current notification list, otherwise it adds this notification. | ||
| ### `removeNotificationById(notificationId)` | ||
| Remove the notification by `id`. | ||
| ## Roadmap | ||
| * Redux implementation | ||
+2
-2
| { | ||
| "name": "react-notifier-system", | ||
| "version": "0.0.5", | ||
| "version": "0.0.6", | ||
| "repository": "sheikhG1900/react-notifier-system", | ||
@@ -25,3 +25,3 @@ "author": "Sheikh Abdul Wahid Ahmed @sheikhG1900", | ||
| "test-flow": "flow", | ||
| "test": "yarn lint && yarn test-flow && yarn test-jest", | ||
| "test": "yarn lint && yarn test-flow && yarn test-jest && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
| "precommit": "yarn test", | ||
@@ -28,0 +28,0 @@ "prepush": "yarn test && yarn prod:build" |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
8131
61.55%5
25%1
-50%78
Infinity%