diff --git a/web/ASC.Web.LoginMobile/src/components/pages/Registration/Registration.jsx b/web/ASC.Web.LoginMobile/src/components/pages/Registration/Registration.jsx index f5e96fb121..310c86376c 100644 --- a/web/ASC.Web.LoginMobile/src/components/pages/Registration/Registration.jsx +++ b/web/ASC.Web.LoginMobile/src/components/pages/Registration/Registration.jsx @@ -1,12 +1,13 @@ -import React, { useEffect } from "react"; +import React, { useEffect, useState } from "react"; import styled from "styled-components"; import { withTranslation } from "react-i18next"; import { Box } from "ASC.Web.Components"; import i18n from "../../../i18n"; -import Header from "../../Header"; -import { RegistrationTitle } from "./sub-components"; +import { fakeApi } from "LoginMobileApi"; + +import { RegistrationTitle, RegistrationForm } from "./sub-components"; const StyledRegistration = styled(Box)` display: grid; @@ -15,14 +16,22 @@ const StyledRegistration = styled(Box)` align-items: center; margin: 33px 32px 0 32px; height: min-content; + width: 100%; `; const RegistrationComponent = ({ t }) => { + const [isLoading, setIsLoading] = useState(false); + + const onJoinHandler = (portalName, email, FirstName, LastName, pass) => { + setIsLoading(true); + fakeApi.join( portalName, email, FirstName, LastName, pass); + }; + return ( <> - Registration + ); diff --git a/web/ASC.Web.LoginMobile/src/components/pages/Registration/sub-components/index.js b/web/ASC.Web.LoginMobile/src/components/pages/Registration/sub-components/index.js index 045e5823f7..f0569a1337 100644 --- a/web/ASC.Web.LoginMobile/src/components/pages/Registration/sub-components/index.js +++ b/web/ASC.Web.LoginMobile/src/components/pages/Registration/sub-components/index.js @@ -1 +1,2 @@ export { default as RegistrationTitle } from "./registration-title"; +export { default as RegistrationForm } from "./registration-form"; diff --git a/web/ASC.Web.LoginMobile/src/components/pages/Registration/sub-components/registration-form.js b/web/ASC.Web.LoginMobile/src/components/pages/Registration/sub-components/registration-form.js new file mode 100644 index 0000000000..a5c970e1c0 --- /dev/null +++ b/web/ASC.Web.LoginMobile/src/components/pages/Registration/sub-components/registration-form.js @@ -0,0 +1,143 @@ +import React, { useState } from "react"; +import styled from "styled-components"; + +import { Button } from "ASC.Web.Components"; + +import { EmailField, PasswordField, TextField } from "../../../fields"; + +const StyledRegistrationForm = styled("form")` + width: 100%; + display: grid; + grid-template-columns: 1fr; + margin-top: 6px; + + .registration-button { + margin-top: 28px; + } +`; + +const RegistrationForm = ({ t, isLoading, onJoin }) => { + const [portalName, setPortalName] = useState({ + val: "", + isValid: false, + }); + + const [email, setEmail] = useState({ val: "", isValid: false }); + + const [firstName, setFirstName] = useState({ + val: "", + isValid: false, + }); + + const [lastName, setLastName] = useState({ + val: "", + isValid: false, + }); + + const [password, setPassword] = useState({ + val: "", + isValid: false, + }); + + const [hasError, setHasError] = useState(false); + + const onChangePortalNameHandler = (val, isValid) => { + setPortalName({ val, isValid }); + }; + + const onChangeEmailHandler = (val, isValid) => { + setEmail({ val, isValid }); + }; + + const onChangeFirstNameHandler = (val, isValid) => { + setFirstName({ val, isValid }); + }; + + const onChangeLastNameHandler = (val, isValid) => { + setLastName({ val, isValid }); + }; + + const onChangePasswordHandler = (val, isValid) => { + setPassword({ val, isValid }); + }; + + const onSubmitHandler = () => { + const isValid = checkingValid(); + if (!isValid) return; + onJoin( + portalName.val, + email.val, + firstName.val, + lastName.val, + password.val + ); + }; + + const checkingValid = () => { + let isValid = false; + if ( + portalName.isValid && + email.isValid && + firstName.isValid && + lastName.isValid && + password.isValid + ) { + isValid = true; + } + setHasError(!isValid); + return isValid; + }; + + return ( + + + + + + +