react-redux-toastr
Advanced tools
Comparing version 4.3.0 to 4.4.0
@@ -18,3 +18,3 @@ 'use strict'; | ||
return props.onClick(); | ||
} }, | ||
}, className: props.className }, | ||
_react2.default.createElement( | ||
@@ -21,0 +21,0 @@ 'p', |
@@ -153,3 +153,4 @@ 'use strict'; | ||
okText: 'ok', | ||
cancelText: 'cancel' | ||
cancelText: 'cancel', | ||
disableCancel: false | ||
} | ||
@@ -156,0 +157,0 @@ }; |
@@ -179,3 +179,3 @@ 'use strict'; | ||
}, | ||
'x' | ||
'\u2715' | ||
); | ||
@@ -182,0 +182,0 @@ }; |
@@ -49,3 +49,4 @@ 'use strict'; | ||
transitionIn = _confirm$options.transitionIn, | ||
transitionOut = _confirm$options.transitionOut; | ||
transitionOut = _confirm$options.transitionOut, | ||
disableCancel = _confirm$options.disableCancel; | ||
@@ -57,3 +58,3 @@ | ||
_this.transitionOut = transitionOut || confirmOptions.transitionOut; | ||
_this.disableCancel = disableCancel != null ? disableCancel : confirmOptions.disableCancel; | ||
(0, _utils._bind)('setTransition removeConfirm handleOnKeyUp handleOnKeyDown', _this); | ||
@@ -152,4 +153,6 @@ _this.isKeyDown = false; | ||
var code = (0, _utils.keyCode)(e); | ||
if (code == ESC) { | ||
if (code == ESC && !this.disableCancel) { | ||
this.handleCancelClick(); | ||
} else if (code == ESC && this.disableCancel) { | ||
this.handleConfirmClick(); | ||
} else if (code == ENTER && this.isKeyDown) { | ||
@@ -179,6 +182,6 @@ this.isKeyDown = false; | ||
_Button2.default, | ||
{ onClick: this.handleConfirmClick.bind(this) }, | ||
{ className: this.disableCancel ? 'full-width' : '', onClick: this.handleConfirmClick.bind(this) }, | ||
this.okText | ||
), | ||
_react2.default.createElement( | ||
this.disableCancel ? null : _react2.default.createElement( | ||
_Button2.default, | ||
@@ -185,0 +188,0 @@ { onClick: this.handleCancelClick.bind(this) }, |
{ | ||
"name": "react-redux-toastr", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "react-redux-toastr is a React toastr message implemented with Redux", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -224,2 +224,15 @@ ##`react-redux-toastr` [demo](http://diegoddox.github.io/react-redux-toastr/) | ||
You can make it so `ok` is the only button by: | ||
- Passing the `disableCancel` prop to the `toasterConfirmOptions` object: | ||
```javascript | ||
const toastrConfirmOptions = { | ||
... | ||
disableCancel: true; | ||
}; | ||
toastr.confirm('You have timed out! Please log back in.', toastrConfirmOptions); | ||
``` | ||
### Avatar: in case you wanna use the same avatar as the example | ||
@@ -226,0 +239,0 @@ [Avatar](https://github.com/diegoddox/react-redux-toastr/blob/master/development/Avatar.js) |
import React from 'react'; | ||
const Button = props => ( | ||
<button type="button" onClick={() => props.onClick()}> | ||
<button type="button" onClick={() => props.onClick()} className={props.className}> | ||
<p>{props.children}</p> | ||
@@ -6,0 +6,0 @@ </button> |
@@ -39,3 +39,4 @@ import React, {Component, PropTypes} from 'react'; | ||
okText: 'ok', | ||
cancelText: 'cancel' | ||
cancelText: 'cancel', | ||
disableCancel: false | ||
} | ||
@@ -42,0 +43,0 @@ }; |
@@ -157,3 +157,3 @@ import CSSCore from 'fbjs/lib/CSSCore'; | ||
> | ||
x | ||
✕ | ||
</button> | ||
@@ -160,0 +160,0 @@ ); |
@@ -21,3 +21,4 @@ import React, {Component, PropTypes} from 'react'; | ||
transitionIn, | ||
transitionOut | ||
transitionOut, | ||
disableCancel | ||
} = confirm.options; | ||
@@ -29,3 +30,3 @@ | ||
this.transitionOut = transitionOut || confirmOptions.transitionOut; | ||
this.disableCancel = (disableCancel != null) ? disableCancel : confirmOptions.disableCancel; | ||
_bind('setTransition removeConfirm handleOnKeyUp handleOnKeyDown', this); | ||
@@ -117,5 +118,7 @@ this.isKeyDown = false; | ||
const code = keyCode(e); | ||
if (code == ESC) { | ||
if (code == ESC && !this.disableCancel) { | ||
this.handleCancelClick(); | ||
} else if (code == ENTER && this.isKeyDown) { | ||
} else if (code == ESC && this.disableCancel) { | ||
this.handleConfirmClick(); | ||
} else if ((code == ENTER && this.isKeyDown)) { | ||
this.isKeyDown = false; | ||
@@ -131,8 +134,12 @@ this.handleConfirmClick(); | ||
<div className="message">{this.props.confirm.message}</div> | ||
<Button onClick={this.handleConfirmClick.bind(this)}> | ||
{this.okText} | ||
</Button> | ||
<Button onClick={this.handleCancelClick.bind(this)}> | ||
{this.cancelText} | ||
</Button> | ||
<Button className={this.disableCancel ? 'full-width' : ''} onClick={this.handleConfirmClick.bind(this)}> | ||
{this.okText} | ||
</Button> | ||
{ | ||
this.disableCancel ? null : ( | ||
<Button onClick={this.handleCancelClick.bind(this)}> | ||
{this.cancelText} | ||
</Button> | ||
) | ||
} | ||
</div> | ||
@@ -139,0 +146,0 @@ <div className="shadow"></div> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109666
2184
251