contentoh-components-library 21.0.24 → 21.0.28
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/components/{molecules/Login/Login.stories.js → atoms/Loading/Loading.stories.js} +7 -7
- package/dist/components/atoms/Loading/index.js +27 -0
- package/dist/components/atoms/Loading/styles.js +18 -0
- package/dist/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +28 -0
- package/dist/components/molecules/EmailResetPasswordLogin/index.js +159 -0
- package/dist/components/molecules/EmailResetPasswordLogin/styles.js +20 -0
- package/dist/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationFirstStep/index.js +371 -0
- package/dist/components/molecules/RegistrationFirstStep/styles.js +20 -0
- package/dist/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationSecondStep/index.js +156 -0
- package/dist/components/molecules/RegistrationSecondStep/styles.js +20 -0
- package/dist/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationThirdStep/index.js +161 -0
- package/dist/components/molecules/RegistrationThirdStep/styles.js +20 -0
- package/dist/components/molecules/{SignIn/SignIn.stories.js → SignInLogin/SignInLogin.stories.js} +7 -7
- package/dist/components/molecules/SignInLogin/index.js +292 -0
- package/dist/components/molecules/SignInLogin/styles.js +20 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +28 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +104 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/styles.js +20 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +69 -0
- package/dist/components/organisms/ChangePassword/ChangePassword.stories.js +28 -0
- package/dist/components/organisms/ChangePassword/index.js +113 -0
- package/dist/components/organisms/ChangePassword/styles.js +18 -0
- package/dist/index.js +150 -46
- package/package.json +5 -2
- package/src/components/atoms/Loading/Loading.stories.js +10 -0
- package/src/components/atoms/Loading/index.js +13 -0
- package/src/components/atoms/Loading/styles.js +57 -0
- package/src/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +11 -0
- package/src/components/molecules/EmailResetPasswordLogin/index.js +87 -0
- package/src/components/molecules/EmailResetPasswordLogin/styles.js +23 -0
- package/src/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +11 -0
- package/src/components/molecules/RegistrationFirstStep/index.js +259 -0
- package/src/components/molecules/RegistrationFirstStep/styles.js +81 -0
- package/src/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +11 -0
- package/src/components/molecules/RegistrationSecondStep/index.js +97 -0
- package/src/components/molecules/RegistrationSecondStep/styles.js +59 -0
- package/src/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +11 -0
- package/src/components/molecules/RegistrationThirdStep/index.js +109 -0
- package/src/components/molecules/RegistrationThirdStep/styles.js +44 -0
- package/src/components/molecules/SignInLogin/SignInLogin.stories.js +11 -0
- package/src/components/molecules/SignInLogin/index.js +205 -0
- package/src/components/molecules/{SignIn → SignInLogin}/styles.js +1 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +11 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +78 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/styles.js +49 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +56 -0
- package/src/components/organisms/ChangePassword/ChangePassword.stories.js +11 -0
- package/src/components/organisms/ChangePassword/index.js +63 -0
- package/src/components/organisms/ChangePassword/styles.js +16 -0
- package/src/index.js +17 -9
- package/dist/components/molecules/Login/index.js +0 -142
- package/dist/components/molecules/Login/styles.js +0 -20
- package/dist/components/molecules/SignIn/index.js +0 -142
- package/dist/components/molecules/SignIn/styles.js +0 -20
- package/src/components/molecules/SignIn/SignIn.stories.js +0 -11
- package/src/components/molecules/SignIn/index.js +0 -79
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentoh-components-library",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.0.28",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@babel/runtime": "^7.17.2",
|
|
6
6
|
"@storybook/addon-postcss": "^2.0.0",
|
|
7
7
|
"@testing-library/jest-dom": "^5.11.4",
|
|
8
8
|
"@testing-library/react": "^11.1.0",
|
|
9
9
|
"@testing-library/user-event": "^12.1.10",
|
|
10
|
+
"aws-amplify": "^4.3.21",
|
|
10
11
|
"axios": "^0.25.0",
|
|
11
12
|
"babel-preset-react-app": "^10.0.1",
|
|
12
13
|
"chart.js": "^3.7.1",
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
"react-chartjs-2": "^4.1.0",
|
|
17
18
|
"react-dom": "^17.0.2",
|
|
18
19
|
"react-image-fallback": "^8.0.0",
|
|
20
|
+
"react-router-dom": "^6.3.0",
|
|
19
21
|
"styled-components": "^5.3.3",
|
|
20
22
|
"web-vitals": "^1.0.1"
|
|
21
23
|
},
|
|
@@ -67,10 +69,11 @@
|
|
|
67
69
|
"@storybook/addon-essentials": "^6.4.1",
|
|
68
70
|
"@storybook/addon-links": "^6.4.1",
|
|
69
71
|
"@storybook/react": "^6.4.1",
|
|
72
|
+
"auth": "^0.0.9",
|
|
70
73
|
"auto": "^10.36.5",
|
|
71
74
|
"babel-loader": "^8.2.3",
|
|
72
75
|
"chromatic": "^6.3.3",
|
|
73
|
-
"contentoh-components-library": "^21.0.
|
|
76
|
+
"contentoh-components-library": "^21.0.26",
|
|
74
77
|
"cross-env": "^7.0.3",
|
|
75
78
|
"storybook-css-modules-preset": "^1.1.1"
|
|
76
79
|
},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
|
|
3
|
+
export const Loading = () => {
|
|
4
|
+
return (
|
|
5
|
+
<Container >
|
|
6
|
+
<div className="loader">
|
|
7
|
+
<span className="first"></span>
|
|
8
|
+
<span className="second"></span>
|
|
9
|
+
<span className="third"></span>
|
|
10
|
+
</div>
|
|
11
|
+
</Container>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const Container = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
height: 100%;
|
|
8
|
+
width: 100%;
|
|
9
|
+
.loader {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
height: 100%;
|
|
14
|
+
width: 100%;
|
|
15
|
+
span {
|
|
16
|
+
display: inline-block;
|
|
17
|
+
border-radius: 100%;
|
|
18
|
+
margin-left: 5px;
|
|
19
|
+
opacity: 1;
|
|
20
|
+
}
|
|
21
|
+
.first {
|
|
22
|
+
background-color: #ff75cf;
|
|
23
|
+
}
|
|
24
|
+
.second {
|
|
25
|
+
background-color: #e33aa9;
|
|
26
|
+
}
|
|
27
|
+
.third {
|
|
28
|
+
background-color: #b12d84;
|
|
29
|
+
}
|
|
30
|
+
span:nth-child(1) {
|
|
31
|
+
width: 16px;
|
|
32
|
+
height: 16px;
|
|
33
|
+
animation: opacitychange 1s ease-in-out infinite;
|
|
34
|
+
}
|
|
35
|
+
span:nth-child(2) {
|
|
36
|
+
width: 18px;
|
|
37
|
+
height: 18px;
|
|
38
|
+
|
|
39
|
+
animation: opacitychange 1s ease-in-out 0.33s infinite;
|
|
40
|
+
}
|
|
41
|
+
span:nth-child(3) {
|
|
42
|
+
width: 20px;
|
|
43
|
+
height: 20px;
|
|
44
|
+
|
|
45
|
+
animation: opacitychange 1s ease-in-out 0.66s infinite;
|
|
46
|
+
}
|
|
47
|
+
@keyframes opacitychange {
|
|
48
|
+
0%,
|
|
49
|
+
100% {
|
|
50
|
+
opacity: 0;
|
|
51
|
+
}
|
|
52
|
+
60% {
|
|
53
|
+
opacity: 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EmailResetPasswordLogin } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/molecules/EmailResetPasswordLogin",
|
|
5
|
+
component: EmailResetPasswordLogin,
|
|
6
|
+
};
|
|
7
|
+
const Template = (args) => <EmailResetPasswordLogin {...args} />;
|
|
8
|
+
|
|
9
|
+
export const EmailResetPasswordLoginDefault = Template.bind({});
|
|
10
|
+
|
|
11
|
+
EmailResetPasswordLoginDefault.args = {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { GradientPanel } from "../../atoms/GradientPanel";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { LogoImage } from "../../atoms/LogoImage";
|
|
5
|
+
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
6
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
7
|
+
import { TagAndInput } from "../../molecules/TagAndInput";
|
|
8
|
+
import { Button } from "../../atoms/GeneralButton";
|
|
9
|
+
|
|
10
|
+
export const EmailResetPasswordLogin = (props) => {
|
|
11
|
+
const [emptyEmail, setEmptyEmail] = useState(false);
|
|
12
|
+
const [invalidEmail, setInvalidEmail] = useState(false);
|
|
13
|
+
const [showErrors, setShowErrors] = useState(false);
|
|
14
|
+
const [awsError, setAwsError] = useState("");
|
|
15
|
+
const [upgradePlanRedirect, setUpgradePlanRedirect] = useState(false);
|
|
16
|
+
//upgradePlanRedirect && (<Redirect/>
|
|
17
|
+
const validate = async (e) => {
|
|
18
|
+
let valid = true;
|
|
19
|
+
setShowErrors(true);
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
const email = document.querySelector("#emailInput").value;
|
|
22
|
+
email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
|
|
23
|
+
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
24
|
+
email
|
|
25
|
+
)
|
|
26
|
+
? setInvalidEmail(true)
|
|
27
|
+
: setInvalidEmail(false);
|
|
28
|
+
emptyEmail && (valid = false);
|
|
29
|
+
invalidEmail && (valid = false);
|
|
30
|
+
|
|
31
|
+
if (valid) {
|
|
32
|
+
try {
|
|
33
|
+
await Auth.forgotPassword(email);
|
|
34
|
+
sessionStorage.setItem("email", JSON.stringify(email));
|
|
35
|
+
sessionStorage.setItem("resetPasswordProcess", JSON.stringify("true"));
|
|
36
|
+
props.setPaso(5);
|
|
37
|
+
} catch (err) {
|
|
38
|
+
setAwsError(err.code);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const loginRight = [
|
|
44
|
+
<LogoImage key="1" />,
|
|
45
|
+
<div className="credenciales" key={"2"}>
|
|
46
|
+
<ScreenHeader
|
|
47
|
+
fontFamily={FontFamily.AvenirNext}
|
|
48
|
+
color={GlobalColors.s5}
|
|
49
|
+
text={"Ingresa tus credenciales"}
|
|
50
|
+
/>
|
|
51
|
+
</div>,
|
|
52
|
+
<div className="user" key="3">
|
|
53
|
+
<TagAndInput
|
|
54
|
+
inputType={"text"}
|
|
55
|
+
inputId={"emailInput"}
|
|
56
|
+
label={"Nombre de usuario"}
|
|
57
|
+
inputPlaceHolder={"username@contentoh.com"}
|
|
58
|
+
/>
|
|
59
|
+
{showErrors && emptyEmail && <label>Ingrese su correo</label>}
|
|
60
|
+
{showErrors && invalidEmail && !emptyEmail && (
|
|
61
|
+
<label>Ingrese un correo valido</label>
|
|
62
|
+
)}
|
|
63
|
+
{showErrors && awsError === "LimitExceededException" && (
|
|
64
|
+
<label>Has cambiado la contraseña recientemente, intenta despues</label>
|
|
65
|
+
)}
|
|
66
|
+
</div>,
|
|
67
|
+
<div className="button-center" key="4">
|
|
68
|
+
<Button
|
|
69
|
+
buttonType={"general-default-button"}
|
|
70
|
+
label={"Enviar"}
|
|
71
|
+
onClick={(e) => validate(e)}
|
|
72
|
+
/>
|
|
73
|
+
</div>,
|
|
74
|
+
<div className="back-login" key="5">
|
|
75
|
+
<p onClick={() => props.setPaso(7)}>Regresar...</p>
|
|
76
|
+
</div>,
|
|
77
|
+
];
|
|
78
|
+
return (
|
|
79
|
+
<Container>
|
|
80
|
+
<GradientPanel
|
|
81
|
+
componentsArray={loginRight}
|
|
82
|
+
panelType={"home-login"}
|
|
83
|
+
panelColor={GlobalColors.white}
|
|
84
|
+
/>
|
|
85
|
+
</Container>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
width: 50%;
|
|
7
|
+
height: 100vh;
|
|
8
|
+
.button-center {
|
|
9
|
+
text-align: center;
|
|
10
|
+
.general-default-button {
|
|
11
|
+
width: 160px;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
.back-login {
|
|
15
|
+
text-align: center;
|
|
16
|
+
margin: 15px !important;
|
|
17
|
+
color: ${GlobalColors.secondary_magenta};
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
font-weight: bold;
|
|
20
|
+
font-family: ${FontFamily.Raleway};
|
|
21
|
+
font-size: 13px;
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RegistrationFirstStep } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/molecules/RegistrationFirstStep",
|
|
5
|
+
component: RegistrationFirstStep,
|
|
6
|
+
};
|
|
7
|
+
const Template = (args) => <RegistrationFirstStep {...args} />;
|
|
8
|
+
|
|
9
|
+
export const RegistrationFirstStepDefault = Template.bind({});
|
|
10
|
+
|
|
11
|
+
RegistrationFirstStepDefault.args = {};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { GradientPanel } from "../../atoms/GradientPanel";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import { LogoImage } from "../../atoms/LogoImage";
|
|
5
|
+
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
6
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
7
|
+
import { TagAndInput } from "../../molecules/TagAndInput";
|
|
8
|
+
import { Button } from "../../atoms/GeneralButton";
|
|
9
|
+
import { GeneralInput } from "../../atoms/GeneralInput";
|
|
10
|
+
|
|
11
|
+
export const RegistrationFirstStep = (props) => {
|
|
12
|
+
const [emptyName, setEmptyName] = useState(false);
|
|
13
|
+
const [emptyLastName, setEmptyLastName] = useState(false);
|
|
14
|
+
const [emptyEmail, setEmptyEmail] = useState(false);
|
|
15
|
+
const [emptyJob, setEmptyJob] = useState(false);
|
|
16
|
+
const [emptyPhone, setEmptyPhone] = useState(false);
|
|
17
|
+
const [invalidEmail, setInvalidEmail] = useState(false);
|
|
18
|
+
|
|
19
|
+
const validate = async (e) => {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
const name = document.querySelector("#nameInput").value;
|
|
22
|
+
const lastName = document.querySelector("#lastNameInput").value;
|
|
23
|
+
const email = document.querySelector("#emailInput").value;
|
|
24
|
+
const job = document.querySelector("#jobInput").value;
|
|
25
|
+
const phone = document.querySelector("#phoneInput").value;
|
|
26
|
+
name === "" ? setEmptyName(true) : setEmptyName(false);
|
|
27
|
+
lastName === "" ? setEmptyLastName(true) : setEmptyLastName(false);
|
|
28
|
+
email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
|
|
29
|
+
job === "" ? setEmptyJob(true) : setEmptyJob(false);
|
|
30
|
+
phone === "" ? setEmptyPhone(true) : setEmptyPhone(false);
|
|
31
|
+
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
32
|
+
email
|
|
33
|
+
)
|
|
34
|
+
? setInvalidEmail(true)
|
|
35
|
+
: setInvalidEmail(false);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const [emptyCountry, setEmptyCountry] = useState(true);
|
|
40
|
+
const [showErrors, setShowErrors] = useState(false);
|
|
41
|
+
const [regError, setRegError] = useState(false);
|
|
42
|
+
const [phoneFormatError, setPhoneFormatError] = useState(false);
|
|
43
|
+
const [emailFormatError, setEmailFormatError] = useState(false);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
JSON.parse(sessionStorage.getItem("nuevoRegistro")).name === "" &&
|
|
47
|
+
sessionStorage.removeItem("registrationError");
|
|
48
|
+
sessionStorage.getItem("registrationError") && setRegError(true);
|
|
49
|
+
if (sessionStorage.getItem("registrationError")) {
|
|
50
|
+
setEmptyName(false);
|
|
51
|
+
setEmptyLastName(false);
|
|
52
|
+
setEmptyEmail(false);
|
|
53
|
+
setEmptyPosition(false);
|
|
54
|
+
setEmptyCountry(false);
|
|
55
|
+
setEmptyPhone(false);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
sessionStorage.getItem("resetPasswordProcess") &&
|
|
59
|
+
sessionStorage.getItem("resetPasswordProcess");
|
|
60
|
+
}, []);
|
|
61
|
+
|
|
62
|
+
let paisesEsp = [
|
|
63
|
+
"Argentina",
|
|
64
|
+
"Colombia",
|
|
65
|
+
"Costa Rica",
|
|
66
|
+
"Ecuador",
|
|
67
|
+
"El Salvador",
|
|
68
|
+
"Honduras",
|
|
69
|
+
"México",
|
|
70
|
+
"Panamá",
|
|
71
|
+
"Perú",
|
|
72
|
+
];
|
|
73
|
+
const updateInfo = (e, newValue) => {
|
|
74
|
+
let nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
|
|
75
|
+
switch (e.target.id) {
|
|
76
|
+
case "nombreInput":
|
|
77
|
+
nuevoUsuario.name = newValue;
|
|
78
|
+
newValue === "" ? setEmptyName(true) : setEmptyName(false);
|
|
79
|
+
break;
|
|
80
|
+
case "apellidoInput":
|
|
81
|
+
nuevoUsuario.lastName = newValue;
|
|
82
|
+
newValue === "" ? setEmptyLastName(true) : setEmptyLastName(false);
|
|
83
|
+
break;
|
|
84
|
+
case "emailInput":
|
|
85
|
+
nuevoUsuario.email = newValue;
|
|
86
|
+
newValue === "" ? setEmptyEmail(true) : setEmptyEmail(false);
|
|
87
|
+
if (
|
|
88
|
+
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
89
|
+
newValue
|
|
90
|
+
)
|
|
91
|
+
) {
|
|
92
|
+
setEmailFormatError(true);
|
|
93
|
+
} else {
|
|
94
|
+
setEmailFormatError(false);
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
case "puestoInput":
|
|
98
|
+
nuevoUsuario.position = newValue;
|
|
99
|
+
newValue === "" ? setEmptyPosition(true) : setEmptyPosition(false);
|
|
100
|
+
break;
|
|
101
|
+
case "telSelect":
|
|
102
|
+
Array.from(newValue).forEach((digit, i) => {
|
|
103
|
+
newValue.charCodeAt(i) < 48
|
|
104
|
+
? setPhoneFormatError(true)
|
|
105
|
+
: setPhoneFormatError(false);
|
|
106
|
+
newValue.charCodeAt(i) > 57
|
|
107
|
+
? setPhoneFormatError(true)
|
|
108
|
+
: setPhoneFormatError(false);
|
|
109
|
+
});
|
|
110
|
+
nuevoUsuario.phone = `${JSON.parse(
|
|
111
|
+
sessionStorage.getItem("countryCode")
|
|
112
|
+
)}${newValue}`;
|
|
113
|
+
newValue === "" ? setEmptyPhone(true) : setEmptyPhone(false);
|
|
114
|
+
break;
|
|
115
|
+
case "paisSelect":
|
|
116
|
+
nuevoUsuario.country = newValue;
|
|
117
|
+
newValue === "" || newValue === "Selecciona tu país"
|
|
118
|
+
? setEmptyCountry(true)
|
|
119
|
+
: setEmptyCountry(false);
|
|
120
|
+
break;
|
|
121
|
+
case "countryCodeSelect":
|
|
122
|
+
sessionStorage.setItem("countryCode", JSON.stringify(newValue));
|
|
123
|
+
nuevoUsuario.phone = `${JSON.parse(
|
|
124
|
+
sessionStorage.getItem("countryCode")
|
|
125
|
+
)}${document.querySelector("#telSelect").value}`;
|
|
126
|
+
break;
|
|
127
|
+
default:
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const validateForm = (evt) => {
|
|
134
|
+
let valid = true;
|
|
135
|
+
evt.preventDefault();
|
|
136
|
+
setShowErrors(true);
|
|
137
|
+
emptyName && (valid = false);
|
|
138
|
+
emptyLastName && (valid = false);
|
|
139
|
+
emptyEmail && (valid = false);
|
|
140
|
+
emptyPosition && (valid = false);
|
|
141
|
+
emptyPhone && (valid = false);
|
|
142
|
+
emptyCountry && (valid = false);
|
|
143
|
+
phoneFormatError && (valid = false);
|
|
144
|
+
emailFormatError && (valid = false);
|
|
145
|
+
!regError && valid && props.setPaso((paso) => props.paso + 1);
|
|
146
|
+
regError && valid && props.setPaso(4);
|
|
147
|
+
};
|
|
148
|
+
const loginRight = [
|
|
149
|
+
<LogoImage key="1" />,
|
|
150
|
+
<div className="credenciales" key={"2"}>
|
|
151
|
+
<ScreenHeader
|
|
152
|
+
fontFamily={FontFamily.AvenirNext}
|
|
153
|
+
color={GlobalColors.s5}
|
|
154
|
+
text={"Ingresa tus credenciales"}
|
|
155
|
+
/>
|
|
156
|
+
</div>,
|
|
157
|
+
<div className="user" key="3">
|
|
158
|
+
<div className="name-registration-user">
|
|
159
|
+
<TagAndInput
|
|
160
|
+
inputType={"text"}
|
|
161
|
+
inputId={"nameInput"}
|
|
162
|
+
label={"Nombre"}
|
|
163
|
+
inputPlaceHolder={"Nombre"}
|
|
164
|
+
/>
|
|
165
|
+
<TagAndInput
|
|
166
|
+
inputType={"text"}
|
|
167
|
+
inputId={"lastNameInput"}
|
|
168
|
+
label={"Apellido"}
|
|
169
|
+
inputPlaceHolder={"Apellido"}
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
{emptyName && <label>Ingrese su nombre</label>}
|
|
173
|
+
{emptyLastName && <label>Ingrese sus apellidos</label>}
|
|
174
|
+
<TagAndInput
|
|
175
|
+
inputType={"text"}
|
|
176
|
+
inputId={"emailInput"}
|
|
177
|
+
label={"Correo electrónico"}
|
|
178
|
+
inputPlaceHolder={"username@contentoh.com"}
|
|
179
|
+
/>
|
|
180
|
+
{emptyEmail && <label>Ingrese su correo</label>}
|
|
181
|
+
{invalidEmail && !emptyEmail && <label>Ingrese un correo válido</label>}
|
|
182
|
+
<TagAndInput
|
|
183
|
+
inputType={"text"}
|
|
184
|
+
inputId={"jobInput"}
|
|
185
|
+
label={"Puesto laboral"}
|
|
186
|
+
inputPlaceHolder={"Puesto dentro de la empresa"}
|
|
187
|
+
/>
|
|
188
|
+
{emptyJob && <label>Ingrese su puesto</label>}
|
|
189
|
+
<ScreenHeader text={"Teléfono"} headerType={"input-name-header"} />
|
|
190
|
+
<div className="phone-registration-user">
|
|
191
|
+
<select name="select" className="phone-options">
|
|
192
|
+
<option>+52</option>
|
|
193
|
+
<option>+54</option>
|
|
194
|
+
<option>+57</option>
|
|
195
|
+
<option>+506</option>
|
|
196
|
+
<option>+593</option>
|
|
197
|
+
<option>+503</option>
|
|
198
|
+
<option>+504</option>
|
|
199
|
+
<option>+507</option>
|
|
200
|
+
<option>+51</option>
|
|
201
|
+
</select>
|
|
202
|
+
<GeneralInput
|
|
203
|
+
inputId={"phoneInput"}
|
|
204
|
+
inputType={"text"}
|
|
205
|
+
inputPlaceholder={"Teléfono"}
|
|
206
|
+
/>
|
|
207
|
+
</div>
|
|
208
|
+
{emptyPhone && <label>Ingrese su número de teléfono</label>}
|
|
209
|
+
<ScreenHeader text={"País"} headerType={"input-name-header"} />
|
|
210
|
+
<select name="select" className="country-options">
|
|
211
|
+
<option value="value1" selected>
|
|
212
|
+
Selecciona tu país
|
|
213
|
+
</option>
|
|
214
|
+
<option value="value2">Argentina</option>
|
|
215
|
+
<option value="value3">Colombia</option>
|
|
216
|
+
<option value="value2">Ecuador</option>
|
|
217
|
+
<option value="value3">El Salvador</option>
|
|
218
|
+
<option value="value2">Honduras</option>
|
|
219
|
+
<option value="value3">México</option>
|
|
220
|
+
<option value="value2">Panamá</option>
|
|
221
|
+
<option value="value3">Perú</option>
|
|
222
|
+
</select>
|
|
223
|
+
{emptyEmail && <label>Seleccione su país</label>}
|
|
224
|
+
</div>,
|
|
225
|
+
<div className="button-end" key="4">
|
|
226
|
+
<Button
|
|
227
|
+
buttonType={"general-default-button"}
|
|
228
|
+
label={"Enviar"}
|
|
229
|
+
onClick={(e) => validate(e)}
|
|
230
|
+
/>
|
|
231
|
+
</div>,
|
|
232
|
+
<div className="progress-bar" key="5">
|
|
233
|
+
<div className="progress-bar-first-step"></div>
|
|
234
|
+
<div className="progress-bar-registration"></div>
|
|
235
|
+
</div>,
|
|
236
|
+
<ScreenHeader
|
|
237
|
+
text={"Paso 1"}
|
|
238
|
+
headerType={"date-header"}
|
|
239
|
+
color={GlobalColors.s4}
|
|
240
|
+
key="6"
|
|
241
|
+
/>,
|
|
242
|
+
<div className="new-login" key="7">
|
|
243
|
+
<p className="pre-registro">
|
|
244
|
+
¿Ya tienes una cuenta?<span> Inicia Sesión</span>
|
|
245
|
+
</p>
|
|
246
|
+
</div>,
|
|
247
|
+
];
|
|
248
|
+
return (
|
|
249
|
+
<Container>
|
|
250
|
+
<div>
|
|
251
|
+
<GradientPanel
|
|
252
|
+
componentsArray={loginRight}
|
|
253
|
+
panelType={"home-login"}
|
|
254
|
+
panelColor={GlobalColors.white}
|
|
255
|
+
/>
|
|
256
|
+
</div>
|
|
257
|
+
</Container>
|
|
258
|
+
);
|
|
259
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
width: 50%;
|
|
7
|
+
height: 100vh;
|
|
8
|
+
.user {
|
|
9
|
+
.name-registration-user {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
input {
|
|
13
|
+
width: 160px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
.input-name-header {
|
|
17
|
+
margin-bottom: 4px;
|
|
18
|
+
margin-top: 12px;
|
|
19
|
+
}
|
|
20
|
+
.phone-registration-user {
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
.phone-options {
|
|
24
|
+
width: 80px;
|
|
25
|
+
}
|
|
26
|
+
input {
|
|
27
|
+
width: 100%;
|
|
28
|
+
}
|
|
29
|
+
& + * {
|
|
30
|
+
margin-top: 10px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
.country-options,
|
|
34
|
+
.phone-options {
|
|
35
|
+
width: 100%;
|
|
36
|
+
border: 1px solid ${GlobalColors.s2};
|
|
37
|
+
font-family: ${FontFamily.AvenirNext};
|
|
38
|
+
color: ${GlobalColors.s4};
|
|
39
|
+
font-weight: normal;
|
|
40
|
+
font-size: 12px;
|
|
41
|
+
line-height: 15px;
|
|
42
|
+
padding: 10px;
|
|
43
|
+
outline: none;
|
|
44
|
+
border-radius: 2px;
|
|
45
|
+
resize: none;
|
|
46
|
+
&:focus {
|
|
47
|
+
border: 1px solid ${GlobalColors.magenta_s2};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.button-end {
|
|
52
|
+
text-align: end;
|
|
53
|
+
.general-default-button {
|
|
54
|
+
width: 160px;
|
|
55
|
+
}
|
|
56
|
+
& + * {
|
|
57
|
+
margin-top: 10px;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
.progress-bar {
|
|
61
|
+
width: 100%;
|
|
62
|
+
height: 8px;
|
|
63
|
+
display: flex;
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
.progress-bar-first-step {
|
|
66
|
+
width: 33.33%;
|
|
67
|
+
background-color: rgb(196, 196, 196);
|
|
68
|
+
}
|
|
69
|
+
.progress-bar-registration {
|
|
70
|
+
background-color: rgb(226, 226, 226);
|
|
71
|
+
width: 66.66%;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
.date-header {
|
|
75
|
+
.new-login {
|
|
76
|
+
& + * {
|
|
77
|
+
margin-top: 20px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RegistrationSecondStep } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/molecules/RegistrationSecondStep",
|
|
5
|
+
component: RegistrationSecondStep,
|
|
6
|
+
};
|
|
7
|
+
const Template = (args) => <RegistrationSecondStep {...args} />;
|
|
8
|
+
|
|
9
|
+
export const RegistrationSecondStepDefault = Template.bind({});
|
|
10
|
+
|
|
11
|
+
RegistrationSecondStepDefault.args = {};
|