contentoh-components-library 21.0.22 → 21.0.23
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.
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.Login = void 0;
|
|
7
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
15
|
+
|
|
8
16
|
var _styles = require("./styles");
|
|
9
17
|
|
|
10
18
|
var _index = require("../../atoms/LogoImage/index");
|
|
@@ -19,9 +27,53 @@ var _TagAndInput = require("../TagAndInput");
|
|
|
19
27
|
|
|
20
28
|
var _variables = require("../../../global-files/variables");
|
|
21
29
|
|
|
30
|
+
var _react = require("react");
|
|
31
|
+
|
|
22
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
33
|
|
|
24
34
|
var Login = function Login() {
|
|
35
|
+
var _useState = (0, _react.useState)(false),
|
|
36
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
|
+
emptyEmail = _useState2[0],
|
|
38
|
+
setEmptyEmail = _useState2[1];
|
|
39
|
+
|
|
40
|
+
var _useState3 = (0, _react.useState)(false),
|
|
41
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
42
|
+
invalidEmail = _useState4[0],
|
|
43
|
+
setInvalidEmail = _useState4[1];
|
|
44
|
+
|
|
45
|
+
var _useState5 = (0, _react.useState)(false),
|
|
46
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
47
|
+
emptyPassword = _useState6[0],
|
|
48
|
+
setEmptyPassword = _useState6[1];
|
|
49
|
+
|
|
50
|
+
var validate = /*#__PURE__*/function () {
|
|
51
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
|
|
52
|
+
var email, password;
|
|
53
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
54
|
+
while (1) {
|
|
55
|
+
switch (_context.prev = _context.next) {
|
|
56
|
+
case 0:
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
email = document.querySelector("#emailInput").value;
|
|
59
|
+
password = document.querySelector("#passwordInput").value;
|
|
60
|
+
email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
|
|
61
|
+
password === "" ? setEmptyPassword(true) : setEmptyPassword(false);
|
|
62
|
+
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email) ? setInvalidEmail(true) : setInvalidEmail(false);
|
|
63
|
+
|
|
64
|
+
case 6:
|
|
65
|
+
case "end":
|
|
66
|
+
return _context.stop();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, _callee);
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
return function validate(_x) {
|
|
73
|
+
return _ref.apply(this, arguments);
|
|
74
|
+
};
|
|
75
|
+
}();
|
|
76
|
+
|
|
25
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
26
78
|
className: "home-login",
|
|
27
79
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -38,15 +90,23 @@ var Login = function Login() {
|
|
|
38
90
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
39
91
|
inputType: "text",
|
|
40
92
|
label: "Nombre de usuario",
|
|
41
|
-
inputPlaceHolder: "username@contentoh.com"
|
|
93
|
+
inputPlaceHolder: "username@contentoh.com",
|
|
94
|
+
inputId: "emailInput"
|
|
42
95
|
})
|
|
96
|
+
}), emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
97
|
+
children: "Ingrese su correo"
|
|
98
|
+
}), invalidEmail && !emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
99
|
+
children: "Ingrese un correo v\xE1lido"
|
|
43
100
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
44
101
|
className: "password",
|
|
45
102
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
46
103
|
inputType: "text",
|
|
47
104
|
label: "Contraseña",
|
|
48
|
-
inputPlaceHolder: "Escribe tu contraseña"
|
|
105
|
+
inputPlaceHolder: "Escribe tu contraseña",
|
|
106
|
+
inputId: "passwordInput"
|
|
49
107
|
})
|
|
108
|
+
}), emptyPassword && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
109
|
+
children: "Ingrese su contrase\xF1a"
|
|
50
110
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
51
111
|
className: "select",
|
|
52
112
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index4.CheckBox, {
|
|
@@ -61,7 +121,10 @@ var Login = function Login() {
|
|
|
61
121
|
className: "button-right",
|
|
62
122
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Button, {
|
|
63
123
|
buttonType: "general-default-button",
|
|
64
|
-
label: "Iniciar sesión"
|
|
124
|
+
label: "Iniciar sesión",
|
|
125
|
+
onClick: function onClick(e) {
|
|
126
|
+
return validate(e);
|
|
127
|
+
}
|
|
65
128
|
})
|
|
66
129
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
67
130
|
className: "new-login",
|
|
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject;
|
|
17
17
|
|
|
18
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: \"white\";\n display: flex;\n height: 100%;\n justify-content: center;\n align-items: center;\n label {\n color: red;\n margin-top: 3px;\n margin-left: 15px;\n font-family: ", ";\n font-size: 11px;\n }\n\n &.home-login {\n .credenciales {\n & + * {\n margin-top: 30px;\n }\n }\n .user {\n & + * {\n margin-top: 20px;\n }\n }\n .password {\n & + * {\n margin-top: 20px;\n }\n }\n .select {\n display: flex;\n justify-content: space-between;\n .active-right {\n font-family: ", ";\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n letter-spacing: -0.015em;\n color: ", ";\n }\n & + * {\n margin-top: 50px;\n }\n }\n .button-right {\n text-align: right;\n & + * {\n margin-top: 55px;\n }\n }\n .new-login {\n p {\n font-family: ", ";\n text-align: right;\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n color: ", ";\n span {\n color: ", ";\n }\n }\n }\n }\n .main-container {\n max-width: 80%;\n max-height: 80%;\n }\n"])), _variables.FontFamily.Raleway_700, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.secondary_magenta);
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: \"white\";\n display: flex;\n height: 100%;\n justify-content: center;\n align-items: center;\n label {\n color: red;\n margin-top: 3px;\n margin-left: 15px;\n font-family: ", ";\n font-size: 11px;\n & + * {\n margin-top: 12px;\n }\n }\n\n &.home-login {\n .credenciales {\n & + * {\n margin-top: 30px;\n }\n }\n .user {\n & + * {\n margin-top: 20px;\n }\n }\n .password {\n & + * {\n margin-top: 20px;\n }\n }\n .select {\n display: flex;\n justify-content: space-between;\n .active-right {\n font-family: ", ";\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n letter-spacing: -0.015em;\n color: ", ";\n cursor: pointer;\n }\n & + * {\n margin-top: 50px;\n }\n }\n .button-right {\n text-align: right;\n & + * {\n margin-top: 55px;\n }\n }\n .new-login {\n p {\n font-family: ", ";\n text-align: right;\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n color: ", ";\n span {\n color: ", ";\n }\n }\n }\n }\n .main-container {\n max-width: 80%;\n max-height: 80%;\n }\n"])), _variables.FontFamily.Raleway_700, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.secondary_magenta);
|
|
19
19
|
|
|
20
20
|
exports.Container = Container;
|
package/package.json
CHANGED
|
@@ -5,8 +5,24 @@ import { Button } from "../../atoms/GeneralButton/index";
|
|
|
5
5
|
import { CheckBox } from "../../atoms/CheckBox/index";
|
|
6
6
|
import { TagAndInput } from "../TagAndInput";
|
|
7
7
|
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
8
|
+
import { useState } from "react";
|
|
8
9
|
|
|
9
10
|
export const Login = () => {
|
|
11
|
+
const [emptyEmail, setEmptyEmail] = useState(false);
|
|
12
|
+
const [invalidEmail, setInvalidEmail] = useState(false);
|
|
13
|
+
const [emptyPassword, setEmptyPassword] = useState(false);
|
|
14
|
+
const validate = async (e) => {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
const email = document.querySelector("#emailInput").value;
|
|
17
|
+
const password = document.querySelector("#passwordInput").value;
|
|
18
|
+
email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
|
|
19
|
+
password === "" ? setEmptyPassword(true) : setEmptyPassword(false);
|
|
20
|
+
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
21
|
+
email
|
|
22
|
+
)
|
|
23
|
+
? setInvalidEmail(true)
|
|
24
|
+
: setInvalidEmail(false);
|
|
25
|
+
};
|
|
10
26
|
return (
|
|
11
27
|
<Container className={"home-login"}>
|
|
12
28
|
<div className="main-container">
|
|
@@ -23,15 +39,20 @@ export const Login = () => {
|
|
|
23
39
|
inputType={"text"}
|
|
24
40
|
label={"Nombre de usuario"}
|
|
25
41
|
inputPlaceHolder={"username@contentoh.com"}
|
|
42
|
+
inputId={"emailInput"}
|
|
26
43
|
/>
|
|
27
44
|
</div>
|
|
45
|
+
{emptyEmail && <label>Ingrese su correo</label>}
|
|
46
|
+
{invalidEmail && !emptyEmail && <label>Ingrese un correo válido</label>}
|
|
28
47
|
<div className="password">
|
|
29
48
|
<TagAndInput
|
|
30
49
|
inputType={"text"}
|
|
31
50
|
label={"Contraseña"}
|
|
32
51
|
inputPlaceHolder={"Escribe tu contraseña"}
|
|
52
|
+
inputId={"passwordInput"}
|
|
33
53
|
/>
|
|
34
54
|
</div>
|
|
55
|
+
{emptyPassword && <label>Ingrese su contraseña</label>}
|
|
35
56
|
<div className="select">
|
|
36
57
|
<CheckBox
|
|
37
58
|
label={"Mantener sesión activada"}
|
|
@@ -44,6 +65,7 @@ export const Login = () => {
|
|
|
44
65
|
<Button
|
|
45
66
|
buttonType={"general-default-button"}
|
|
46
67
|
label={"Iniciar sesión"}
|
|
68
|
+
onClick={(e) => validate(e)}
|
|
47
69
|
/>
|
|
48
70
|
</div>
|
|
49
71
|
<div className="new-login">
|
|
@@ -13,6 +13,9 @@ export const Container = styled.div`
|
|
|
13
13
|
margin-left: 15px;
|
|
14
14
|
font-family: ${FontFamily.Raleway_700};
|
|
15
15
|
font-size: 11px;
|
|
16
|
+
& + * {
|
|
17
|
+
margin-top: 12px;
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
&.home-login {
|
|
@@ -41,6 +44,7 @@ export const Container = styled.div`
|
|
|
41
44
|
line-height: 24px;
|
|
42
45
|
letter-spacing: -0.015em;
|
|
43
46
|
color: ${GlobalColors.s5};
|
|
47
|
+
cursor: pointer;
|
|
44
48
|
}
|
|
45
49
|
& + * {
|
|
46
50
|
margin-top: 50px;
|