|
|
@ -6,6 +6,7 @@ export default class ModalRoot extends React.PureComponent {
|
|
|
|
static propTypes = {
|
|
|
|
static propTypes = {
|
|
|
|
children: PropTypes.node,
|
|
|
|
children: PropTypes.node,
|
|
|
|
onClose: PropTypes.func.isRequired,
|
|
|
|
onClose: PropTypes.func.isRequired,
|
|
|
|
|
|
|
|
noEsc: PropTypes.bool,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
state = {
|
|
|
|
state = {
|
|
|
@ -16,7 +17,7 @@ export default class ModalRoot extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
handleKeyUp = (e) => {
|
|
|
|
handleKeyUp = (e) => {
|
|
|
|
if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27)
|
|
|
|
if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27)
|
|
|
|
&& !!this.props.children && !this.props.props.noEsc) {
|
|
|
|
&& !!this.props.children && !this.props.noEsc) {
|
|
|
|
this.props.onClose();
|
|
|
|
this.props.onClose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|