contentoh-components-library 21.4.58 → 21.4.59

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.
package/dist/index.js CHANGED
@@ -1018,6 +1018,19 @@ Object.keys(_TableResizable).forEach(function (key) {
1018
1018
  });
1019
1019
  });
1020
1020
 
1021
+ var _index76 = require("./components/organisms/SideModal/index");
1022
+
1023
+ Object.keys(_index76).forEach(function (key) {
1024
+ if (key === "default" || key === "__esModule") return;
1025
+ if (key in exports && exports[key] === _index76[key]) return;
1026
+ Object.defineProperty(exports, key, {
1027
+ enumerable: true,
1028
+ get: function get() {
1029
+ return _index76[key];
1030
+ }
1031
+ });
1032
+ });
1033
+
1021
1034
  var _PanelLayout = require("./components/organisms/PanelLayout");
1022
1035
 
1023
1036
  Object.keys(_PanelLayout).forEach(function (key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.4.58",
3
+ "version": "21.4.59",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -0,0 +1,23 @@
1
+ import { SideModal } from ".";
2
+ import { ButtonV2 } from "../../atoms/ButtonV2";
3
+
4
+ export default {
5
+ title: "Components/organisms/SideModal",
6
+ component: SideModal,
7
+ };
8
+
9
+ const Template = (args) => <SideModal {...args} />;
10
+
11
+ export const DefaultSideModal = Template.bind({});
12
+ DefaultSideModal.args = {
13
+ show: false,
14
+ header: [
15
+ <div className="title-container">
16
+ <h2></h2>
17
+ </div>,
18
+ <ButtonV2 label="Ir al Checkout" />,
19
+ <ButtonV2 label="X" />,
20
+ ],
21
+ body: <></>,
22
+ footer: <></>,
23
+ };
@@ -0,0 +1,50 @@
1
+ import { useRef } from "react";
2
+ import { Container } from "./styles";
3
+ import { useEffect } from "react";
4
+ import { PropaneSharp } from "@mui/icons-material";
5
+
6
+ export const SideModal = ({
7
+ header,
8
+ body,
9
+ footer,
10
+ show,
11
+ setShow,
12
+ id = "side-modal",
13
+ }) => {
14
+ const modal = useRef();
15
+
16
+ const closeModal = (e) => {
17
+ if (!e.target.closest(`#${id}`) && show) {
18
+ document.removeEventListener("click", closeModal, false);
19
+ modal?.current?.classList?.remove("shown");
20
+ setShow && setShow(false);
21
+ }
22
+ };
23
+
24
+ useEffect(() => {
25
+ if (show && modal.current) {
26
+ document.addEventListener("click", closeModal, false);
27
+ modal?.current?.classList?.add("shown");
28
+ }
29
+ }, [show]);
30
+
31
+ useEffect(() => {
32
+ return () => {
33
+ document.removeEventListener("click", closeModal, false);
34
+ modal?.current?.classList?.remove("shown");
35
+ setShow && setShow(false);
36
+ };
37
+ }, []);
38
+
39
+ return (
40
+ show && (
41
+ <Container>
42
+ <div id={id} ref={modal} className="modal-container">
43
+ <div className="modal-header">{header}</div>
44
+ <div className="modal-body">{body}</div>
45
+ <div className="modal-footer">{footer}</div>
46
+ </div>
47
+ </Container>
48
+ )
49
+ );
50
+ };
@@ -0,0 +1,30 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Container = styled.div`
4
+ width: 100vw;
5
+ height: 100vh;
6
+ position: fixed;
7
+ z-index: 9999999;
8
+ background-color: transparent;
9
+ top: 0;
10
+ left: 0;
11
+
12
+ .modal-container {
13
+ width: 600px;
14
+ height: 100%;
15
+ position: absolute;
16
+ right: -600px;
17
+ background-color: #fff;
18
+ display: flex;
19
+ flex-direction: column;
20
+ box-shadow: -0.5px 0px 5px #f0f0f0;
21
+ border: 1px solid #f0f0f0;
22
+ .modal-body {
23
+ flex: 1;
24
+ }
25
+
26
+ &.shown {
27
+ right: 0;
28
+ }
29
+ }
30
+ `;
package/src/index.js CHANGED
@@ -81,6 +81,7 @@ export * from "./components/organisms/Modal/index";
81
81
  export * from "./components/organisms/OrderDetail/index";
82
82
  export * from "./components/organisms/RangeCalendar";
83
83
  export * from "./components/organisms/TableResizable";
84
+ export * from "./components/organisms/SideModal/index";
84
85
  export * from "./components/organisms/PanelLayout";
85
86
 
86
87
  //pages
@@ -1,23 +0,0 @@
1
- import styled from "styled-components";
2
- import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
-
4
- export const Container = styled.div`
5
- font-family: ${FontFamily.Raleway_500};
6
- color: ${GlobalColors.s5};
7
- font-size: 14px;
8
- line-height: 21px;
9
- border-bottom: 2px solid ${GlobalColors.s3};
10
- width: 149px;
11
- padding-bottom: 5px;
12
- transition: 0.1s all;
13
- cursor: pointer;
14
-
15
- &.active {
16
- font-size: 18px;
17
- border-bottom: 2px solid ${GlobalColors.magenta_s2};
18
- }
19
-
20
- & + * {
21
- margin-left: 10px;
22
- }
23
- `;