contentoh-components-library 21.3.63 → 21.3.64

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.
@@ -22,6 +22,8 @@ var SideModal = function SideModal(_ref) {
22
22
  var modal = (0, _react.useRef)();
23
23
 
24
24
  var closeModal = function closeModal(e) {
25
+ console.log("borrado");
26
+
25
27
  if (!e.target.closest("#".concat(id)) && show) {
26
28
  var _modal$current, _modal$current$classL;
27
29
 
@@ -39,6 +41,14 @@ var SideModal = function SideModal(_ref) {
39
41
  modal === null || modal === void 0 ? void 0 : (_modal$current2 = modal.current) === null || _modal$current2 === void 0 ? void 0 : (_modal$current2$class = _modal$current2.classList) === null || _modal$current2$class === void 0 ? void 0 : _modal$current2$class.add("shown");
40
42
  }
41
43
  }, [show]);
44
+ (0, _react.useEffect)(function () {
45
+ return function () {
46
+ var _modal$current3, _modal$current3$class;
47
+
48
+ document.removeEventListener("click", closeModal, false);
49
+ modal === null || modal === void 0 ? void 0 : (_modal$current3 = modal.current) === null || _modal$current3 === void 0 ? void 0 : (_modal$current3$class = _modal$current3.classList) === null || _modal$current3$class === void 0 ? void 0 : _modal$current3$class.remove("shown");
50
+ };
51
+ }, []);
42
52
  return show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
43
53
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
44
54
  id: id,
@@ -13,6 +13,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
14
  var _templateObject;
15
15
 
16
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100vw;\n height: 100vh;\n position: fixed;\n z-index: 9999999;\n background-color: transparent;\n\n .modal-container {\n width: 600px;\n height: 100%;\n position: absolute;\n right: -600px;\n background-color: #fff;\n\n &.shown {\n right: 0;\n }\n }\n"])));
16
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100vw;\n height: 100vh;\n position: fixed;\n z-index: 9999999;\n background-color: transparent;\n top: 0;\n left: 0;\n\n .modal-container {\n width: 600px;\n height: 100%;\n position: absolute;\n right: -600px;\n background-color: #fff;\n display: flex;\n flex-direction: column;\n\n .modal-body {\n flex: 1;\n }\n\n &.shown {\n right: 0;\n }\n }\n"])));
17
17
 
18
18
  exports.Container = Container;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.3.63",
3
+ "version": "21.3.64",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -13,6 +13,7 @@ export const SideModal = ({
13
13
  const modal = useRef();
14
14
 
15
15
  const closeModal = (e) => {
16
+ console.log("borrado");
16
17
  if (!e.target.closest(`#${id}`) && show) {
17
18
  document.removeEventListener("click", closeModal, false);
18
19
  modal?.current?.classList?.remove("shown");
@@ -27,6 +28,13 @@ export const SideModal = ({
27
28
  }
28
29
  }, [show]);
29
30
 
31
+ useEffect(() => {
32
+ return () => {
33
+ document.removeEventListener("click", closeModal, false);
34
+ modal?.current?.classList?.remove("shown");
35
+ };
36
+ }, []);
37
+
30
38
  return (
31
39
  show && (
32
40
  <Container>
@@ -6,6 +6,8 @@ export const Container = styled.div`
6
6
  position: fixed;
7
7
  z-index: 9999999;
8
8
  background-color: transparent;
9
+ top: 0;
10
+ left: 0;
9
11
 
10
12
  .modal-container {
11
13
  width: 600px;
@@ -13,6 +15,12 @@ export const Container = styled.div`
13
15
  position: absolute;
14
16
  right: -600px;
15
17
  background-color: #fff;
18
+ display: flex;
19
+ flex-direction: column;
20
+
21
+ .modal-body {
22
+ flex: 1;
23
+ }
16
24
 
17
25
  &.shown {
18
26
  right: 0;