rdm-notifications
v0.2.0
Published
Notifications for redux-dynamic-modules
Downloads
7
Readme
Notifications module for "redux dyanmic modules" enabled projects.
Provided is:
- Component Notifications which will absolutely position a notifications panel and accept actions to display.
Props:
- reduxKey - the root key for this component in the redux store, default 'notifications'.
Actions
NOTIFICATIONS_NOTIFY
Props
- title : a title for this notification.
- message : the notification message.
- messageType : an arbituary type for this message, types are "success", "error", "warning", "info", default "info".
- duration : the length of time to display this notification in milliseconds, default 5000.
- clickExpire : user is required to click the notification to expire it, default false.
Usage
import React from 'react';
import {connect} from 'react-redux';
import {Notifications} from 'rdm-notifications';
@connect()
class Example extends React.Component {
render() {
return (
<div>
<Notifications />
<div onClick={this.onNotify}><span>Click Me to Notify</span></div>
</div>
)
}
onNotify = evt => this.props.dispatch({
type: 'NOTIFICATIONS_NOTIFY',
title: 'Demo',
message: 'This is a notification',
messageType: 'success',
clickExpire: true
})
}