https://github.com/react-component/m-notification
https://github.com/react-component/m-notification
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/react-component/m-notification
- Owner: react-component
- License: mit
- Created: 2017-11-29T09:46:42.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-07-30T21:16:37.000Z (over 4 years ago)
- Last Synced: 2025-08-09T15:31:21.008Z (5 months ago)
- Language: JavaScript
- Size: 393 KB
- Stars: 23
- Watchers: 2
- Forks: 5
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.md
Awesome Lists containing this project
README
# rmc-notification
---
React Notification UI Component
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![gemnasium deps][gemnasium-image]][gemnasium-url]
[![node version][node-image]][node-url]
[![npm download][download-image]][download-url]
[npm-image]: http://img.shields.io/npm/v/rmc-notification.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rmc-notification
[travis-image]: https://img.shields.io/travis/react-component/m-notification.svg?style=flat-square
[travis-url]: https://travis-ci.org/react-component/m-notification
[coveralls-image]: https://img.shields.io/coveralls/react-component/m-notification.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/react-component/m-notification?branch=master
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/m-notification.svg?style=flat-square
[gemnasium-url]: https://gemnasium.com/react-component/m-notification
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
[node-url]: http://nodejs.org/download/
[download-image]: https://img.shields.io/npm/dm/rmc-notification.svg?style=flat-square
[download-url]: https://npmjs.org/package/rmc-notification
## Development
```
npm install
npm start
```
## Example
http://localhost:8000/examples/
online example: http://react-component.github.io/m-notification/examples/
## Feature
* support ie8,ie8+,chrome,firefox,safari
## install
[](https://npmjs.org/package/rmc-notification)
## Usage
```js
var Notification = require('rmc-notification');
Notification.newInstance({}, notification => {
notification.notice({
content: 'content'
});
});
```
## API
### Notification.newInstance(props, (notification) => void) => void
props details:
name
type
default
description
prefixCls
String
prefix class name for notification container
style
Object
{'top': 65, left: '50%'}
additional style for notification container.
getContainer
getContainer(): HTMLElement
function returning html node which will act as notification container
### notification.notice(props)
props details:
name
type
default
description
content
React.Element
content of notice
key
String
id of this notice
closable
Boolean
whether show close button
onClose
Function
called when notice close
duration
number
1.5
after duration of time, this notice will disappear.(seconds)
style
Object
{ right: '50%' }
additional style for single notice node.
### notification.removeNotice(key:string)
remove single notice with specified key
### notification.destroy()
destroy current notification
## Test Case
```
npm test
npm run chrome-test
```
## Coverage
```
npm run coverage
```
open coverage/ dir
## License
rmc-notification is released under the MIT license.