From 0b01a2e78b5f8b6f1e57eefef56d608dbefa0f0c Mon Sep 17 00:00:00 2001 From: ahtesham-quraish Date: Thu, 28 Mar 2024 17:57:35 +0500 Subject: [PATCH] feat: create login form Description: Create login form using paragon form fields VAN-1882 --- src/authn-component/index.jsx | 3 +- src/forms/index.jsx | 4 +++ src/forms/login/index.jsx | 67 +++++++++++++++++++++++++++++++++++ src/forms/login/index.scss | 12 +++++++ src/forms/login/messages.js | 46 ++++++++++++++++++++++++ 5 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 src/forms/index.jsx create mode 100644 src/forms/login/index.jsx create mode 100644 src/forms/login/index.scss create mode 100644 src/forms/login/messages.js diff --git a/src/authn-component/index.jsx b/src/authn-component/index.jsx index 4f3bea6a..ac9bfd73 100644 --- a/src/authn-component/index.jsx +++ b/src/authn-component/index.jsx @@ -3,6 +3,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import BaseContainer from '../base-container'; +import { LoginForm } from '../forms'; /** * Main component that holds the logic for conditionally rendering login or registration form. @@ -17,7 +18,7 @@ const AuthnComponent = ({ open, setOpen, }) => ( -
Login form
+
); diff --git a/src/forms/index.jsx b/src/forms/index.jsx new file mode 100644 index 00000000..a0f9ff7a --- /dev/null +++ b/src/forms/index.jsx @@ -0,0 +1,4 @@ +// TODO: This will be removed when register form will be exported +/* eslint-disable import/prefer-default-export */ + +export { default as LoginForm } from './login'; diff --git a/src/forms/login/index.jsx b/src/forms/login/index.jsx new file mode 100644 index 00000000..e9e9f5ee --- /dev/null +++ b/src/forms/login/index.jsx @@ -0,0 +1,67 @@ +import React from 'react'; + +import { useIntl } from '@edx/frontend-platform/i18n'; +import { + Button, Container, Form, Hyperlink, +} from '@openedx/paragon'; + +import messages from './messages'; +import SocialAuthButtons from '../../common-ui/SocialAuthButtons'; + +import './index.scss'; + +/** + * Login form component that holds the login form functionality. + * + * @returns {JSX.Element} The rendered login component along with social auth buttons. + */ + +const LoginForm = () => { + const { formatMessage } = useIntl(); + + return ( + +

{formatMessage(messages.loginFormHeadingText)}

+ +
+ {formatMessage(messages.loginFormOrTxt)} +
+
+ + + + + + + + + + + + + {formatMessage(messages.loginFormForgotPasswordButtonText)} + + + + + + + + {formatMessage(messages.loginFormSignUpHelpingText)}  + + + {formatMessage(messages.loginFormSignUpLink)} + + +
+
+ ); +}; + +export default LoginForm; diff --git a/src/forms/login/index.scss b/src/forms/login/index.scss new file mode 100644 index 00000000..235e293d --- /dev/null +++ b/src/forms/login/index.scss @@ -0,0 +1,12 @@ +.form-layout { + padding: 3.5rem 2.5rem 3.5rem 2.5rem; +} + +.hyper-link { + cursor: pointer; +} + +.pgn__form-control-floating-label-text:after { + content:"*"; + color: #AB0D02; + } diff --git a/src/forms/login/messages.js b/src/forms/login/messages.js new file mode 100644 index 00000000..cf78e7d9 --- /dev/null +++ b/src/forms/login/messages.js @@ -0,0 +1,46 @@ +import { defineMessages } from '@edx/frontend-platform/i18n'; + +const messages = defineMessages({ + loginFormHeadingText: { + id: 'login.form.heading.text', + defaultMessage: 'Login', + description: 'Text of heading', + }, + loginFormSignInButtonText: { + id: 'login.form.signin.button.text', + defaultMessage: 'Sign in', + description: 'Text of sign in button', + }, + loginFormForgotPasswordButtonText: { + id: 'login.form.forgot.password.button.text', + defaultMessage: 'Forgot Password?', + description: 'Button text for forgot password', + }, + loginFormSignUpHelpingText: { + id: 'login.form.sign.up.helping.text', + defaultMessage: 'Don’t have an account yet?', + description: 'Description of sign up link helping text', + }, + loginFormSignUpLink: { + id: 'login.form.sign.up.link.text', + defaultMessage: 'Create an account', + description: 'Description of sign up link', + }, + loginFormEmailText: { + id: 'login.form.email.field.text', + defaultMessage: 'Email', + description: 'Email field label', + }, + loginFormPasswordText: { + id: 'login.form.password.field.text', + defaultMessage: 'Password', + description: 'Password field label', + }, + loginFormOrTxt: { + id: 'login.form.or.message', + defaultMessage: 'or', + description: 'Text of or', + }, +}); + +export default messages;