@ludo.ninja/components 2.3.52 → 2.3.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
7
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
9
|
const ui_1 = require("../../store/ui");
|
|
9
10
|
const colors_1 = require("../../styles/colors");
|
|
@@ -35,6 +36,17 @@ const Overlay = () => {
|
|
|
35
36
|
closeOverlay: state.closeOverlay,
|
|
36
37
|
isOverlayActive: state.isOverlayActive,
|
|
37
38
|
}));
|
|
39
|
+
(0, react_1.useEffect)(() => {
|
|
40
|
+
const handleEsc = (event) => {
|
|
41
|
+
if (event.key === 'Escape') {
|
|
42
|
+
closeOverlay();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
window.addEventListener('keydown', handleEsc);
|
|
46
|
+
return () => {
|
|
47
|
+
window.removeEventListener('keydown', handleEsc);
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
38
50
|
return ((0, jsx_runtime_1.jsx)(StyledOverlay, { isActive: isOverlayActive, onClick: closeOverlay, children: (0, jsx_runtime_1.jsx)("div", { className: 'blur' }) }));
|
|
39
51
|
};
|
|
40
52
|
// Export
|