Skip to content

Commit edca510

Browse files
committed
Merge branch 'release/0.2.17'
2 parents d37db94 + 380ce74 commit edca510

11 files changed

+6611
-78
lines changed

.eslintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
node_modeules/
1+
node_modules/
22
dist/

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 0.2.17 - Feb 21, 2018
4+
5+
* Dismissible enhancements (thanks to @marudor)
6+
37
## 0.2.16 - Oct 19, 2017
48

59
* Support for React 16 (thanks to @marudor)

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ The notification object has the following properties:
107107
| level | string | null | Level of the notification. Available: **success**, **error**, **warning** and **info** |
108108
| position | string | tr | Position of the notification. Available: **tr (top right)**, **tl (top left)**, **tc (top center)**, **br (bottom right)**, **bl (bottom left)**, **bc (bottom center)** |
109109
| autoDismiss | integer | 5 | Delay in seconds for the notification go away. Set this to **0** to not auto-dismiss the notification |
110-
| dismissible | bool | true | Set if notification is dismissible by the user. [See more](#dismissible) |
110+
| dismissible | string | both | Settings controlling how the user can dismiss the notification and whether the dismiss button is visible. Available: **both (The disable button is visible and the user can click anywhere on the notification to dismiss)**, **click (The disable button is NOT visible and the user can click anywhere on the notification to dismiss)**, **button (The user can click on the disable button to dismiss the notifiction)**, **none (None [See more](#dismissible))** |
111111
| action | object | null | Add a button with label and callback function (callback is optional). [See more](#action) |
112112
| children | element,string | null | Adds custom content, and overrides `action` (if defined) [See more](#children) |
113113
| onAdd | function | null | A callback function that will be called when the notification is successfully added. The first argument is the original notification e.g. `function (notification) { console.log(notification.title + 'was added'); }` |
@@ -117,7 +117,7 @@ The notification object has the following properties:
117117

118118
### Dismissible
119119

120-
If set to false, the notification will not display the dismiss ('x') button and will only be dismissible programmatically or after autoDismiss timeout. [See more](#removenotificationnotification)
120+
If set to 'none', the button will only be dismissible programmatically or after autoDismiss timeout. [See more](#removenotificationnotification)
121121

122122
### Action
123123

example/src/scripts/App.jsx

+18-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ NotificationSystemExample = createReactClass({
5454
position: 'tr',
5555
autoDismiss: 0
5656
},
57+
{
58+
title: 'I don\'t have a dismiss button...',
59+
message: 'But you can still click to get rid of me.',
60+
autoDismiss: 0,
61+
level: 'success',
62+
position: 'tr',
63+
dismissible: 'click'
64+
},
5765
{
5866
title: 'Bad things can happen too!',
5967
message: 'Four notification types: `success`, `error`, `warning` and `info`',
@@ -87,6 +95,14 @@ NotificationSystemExample = createReactClass({
8795
autoDismiss: 0,
8896
level: 'error',
8997
position: 'br'
98+
},
99+
{
100+
title: 'I\'m here forever...',
101+
message: 'Until you click the dismiss button.',
102+
autoDismiss: 0,
103+
level: 'error',
104+
position: 'br',
105+
dismissible: 'button'
90106
}
91107
],
92108

@@ -143,8 +159,8 @@ NotificationSystemExample = createReactClass({
143159
<small className="more-magic">Click twice for more awesomeness!</small>
144160
</div>
145161
<div className="github-buttons">
146-
<a className="github-button" href="https://github.com/igorprado/react-notification-system" data-style="mega" data-icon="octicon-star" data-count-href="/igorprado/react-notification-system/stargazers" data-count-api="/repos/igorprado/react-notification-system#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star igorprado/react-notification-system on GitHub">Star</a>
147-
<a className="github-button" href="https://github.com/igorprado/react-notification-system/fork" data-style="mega" data-icon="octicon-repo-forked" data-count-href="/igorprado/react-notification-system/network" data-count-api="/repos/igorprado/react-notification-system#forks_count" data-count-aria-label="# forks on GitHub" aria-label="Fork igorprado/react-notification-system on GitHub">Fork</a>
162+
<a className="github-button" href="https://github.com/igorprado/react-notification-system" data-size="large" data-icon="octicon-star" data-count-href="/igorprado/react-notification-system/stargazers" data-show-count="true" data-count-aria-label="# stargazers on GitHub" aria-label="Star igorprado/react-notification-system on GitHub">Star</a>
163+
<a className="github-button" href="https://github.com/igorprado/react-notification-system/fork" data-size="large" data-icon="octicon-repo-forked" data-count-href="/igorprado/react-notification-system/network" data-show-count="true" data-count-aria-label="# forks on GitHub" aria-label="Fork igorprado/react-notification-system on GitHub">Fork</a>
148164
</div>
149165
</div>
150166
</header>

example/src/scripts/NotificationGenerator.jsx

+11-18
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@ module.exports = createReactClass({
6262
console.log('%cNotification ' + notification.uid + ' was removed.', 'font-weight: bold; color: #eb4d00');
6363
},
6464

65-
_changedDismissible: function() {
66-
var notification = this.state.notification;
67-
notification.dismissible = !notification.dismissible;
68-
69-
this.setState({
70-
notification: notification
71-
});
72-
},
73-
7465
_changedAllowHTML: function() {
7566
var state = this.state;
7667
var allowHTML = !this.state.allowHTML;
@@ -124,7 +115,7 @@ module.exports = createReactClass({
124115
level: 'error',
125116
position: 'tr',
126117
autoDismiss: 5,
127-
dismissible: true,
118+
dismissible: 'both',
128119
action: null,
129120
actionState: false
130121
},
@@ -228,20 +219,22 @@ module.exports = createReactClass({
228219
<small className={ error.level }>Open console to see the error after creating a notification.</small>
229220
</div>
230221

222+
<div className="form-group">
223+
<label>Dismissible:</label>
224+
<select className="form-control" name="dismissible" onChange={ this._changed } value={ notification.dismissible }>
225+
<option value="both">Both (both)</option>
226+
<option value="click">Click (no dismiss button) (click)</option>
227+
<option value="button">Dismiss button only (button)</option>
228+
<option value="none">None (none)</option>
229+
</select>
230+
</div>
231+
231232
<div className="form-group">
232233
<label>Auto Dismiss:</label>
233234
<input className="form-control" name="autoDismiss" onChange={ this._changed } type="text" value={ notification.autoDismiss }/>
234235
<small>secs (0 means infinite)</small>
235236
</div>
236237

237-
<div className="form-group">
238-
<div className="checkbox">
239-
<label>
240-
<input checked={ notification.dismissible } onChange={ this._changedDismissible } type="checkbox"/> Can user dismiss?
241-
</label>
242-
</div>
243-
</div>
244-
245238
<div className="form-group">
246239
<div className="checkbox">
247240
<label>

0 commit comments

Comments
 (0)