react-notification
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -137,3 +137,3 @@ 'use strict'; | ||
if (nextProps.onDismiss && nextProps.isActive) { | ||
setTimeout(nextProps.onDismiss, this.props.dismissAfter); | ||
setTimeout(nextProps.onDismiss, nextProps.dismissAfter); | ||
} | ||
@@ -148,5 +148,10 @@ }; | ||
Notification.prototype.render = function render() { | ||
var className = 'notification-bar'; | ||
if (this.props.isActive) className += ' ' + this.props.activeClassName; | ||
if (this.props.className) className += ' ' + this.props.className; | ||
return _react2['default'].createElement( | ||
'div', | ||
{ className: 'notification-bar', style: this.getBarStyle() }, | ||
{ className: className, style: this.getBarStyle() }, | ||
_react2['default'].createElement( | ||
@@ -173,7 +178,9 @@ 'div', | ||
message: _react.PropTypes.string.isRequired, | ||
action: _react.PropTypes.string.isRequired, | ||
action: _react.PropTypes.oneOfType([_react.PropTypes.bool, _react.PropTypes.string]), | ||
onClick: _react.PropTypes.func, | ||
styles: _react.PropTypes.oneOfType([_react.PropTypes.object, _react.PropTypes.bool]), | ||
dismissAfter: _react.PropTypes.number, | ||
onDismis: _react.PropTypes.func | ||
onDismis: _react.PropTypes.func, | ||
className: _react.PropTypes.string, | ||
activeClassName: _react.PropTypes.string | ||
}, | ||
@@ -185,3 +192,4 @@ enumerable: true | ||
isActive: false, | ||
dismissAfter: 2000 | ||
dismissAfter: 2000, | ||
activeClassName: 'notification-bar-active' | ||
}, | ||
@@ -188,0 +196,0 @@ enumerable: true |
{ | ||
"name": "react-notification", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "Snackbar style notification component for React.", | ||
@@ -5,0 +5,0 @@ "main": "dist/notification.js", |
@@ -36,2 +36,4 @@ # react-notification [![npm version](https://badge.fury.io/js/react-notification.svg)](http://badge.fury.io/js/react-notification) [![Dependency Status](https://david-dm.org/pburtchaell/react-classes.svg)](https://david-dm.org/pburtchaell/react-notification) | ||
| style | object or boolean | Custom styles to apply to the component* | | | | ||
| className | string | Custom class to apply to the top-level component | | | | ||
| activeClassName | string | Custom class to apply to the top-level component when active | | | | ||
| dismissAfter | number | Timeout for onDismiss event | | `2000` | | ||
@@ -38,0 +40,0 @@ |
125091
365
106