-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Description: Create login form using paragon form fields VAN-1882
- Loading branch information
1 parent
c7a2ba0
commit 86b7b88
Showing
5 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
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 ( | ||
<Container size="lg" className="w-100 h-100 overflow-auto form-layout"> | ||
<h1 className="display-1 font-italic text-center mb-4">{formatMessage(messages.loginFormHeading1)}</h1> | ||
<SocialAuthButtons /> | ||
<div className="text-center mb-4.5 mt-4.5"> | ||
{formatMessage(messages.loginFormHeading2)} | ||
</div> | ||
<Form> | ||
<Form.Row className="mb-4"> | ||
<Form.Group controlId="email" className="w-100 m-0"> | ||
<Form.Control | ||
type="email" | ||
floatingLabel={formatMessage(messages.loginFormEmailFieldLabel)} | ||
/> | ||
</Form.Group> | ||
</Form.Row> | ||
<Form.Row className="mb-3"> | ||
<Form.Group controlId="password" className="w-100 m-0"> | ||
<Form.Control | ||
type="password" | ||
floatingLabel={formatMessage(messages.loginFormPasswordFieldLabel)} | ||
/> | ||
</Form.Group> | ||
</Form.Row> | ||
<Form.Row> | ||
<Hyperlink className="hyper-link"> | ||
{formatMessage(messages.loginFormForgotPasswordButton)} | ||
</Hyperlink> | ||
</Form.Row> | ||
<Form.Row className="mt-6 mb-4.5"> | ||
<Button className="w-100" variant="primary">{formatMessage(messages.loginFormSignInButton)}</Button> | ||
</Form.Row> | ||
<Form.Row> | ||
<span> | ||
{formatMessage(messages.loginFormRegistrationHelpText)} | ||
</span> | ||
<Hyperlink className="hyper-link"> | ||
{formatMessage(messages.loginFormRegistrationLink)} | ||
</Hyperlink> | ||
</Form.Row> | ||
</Form> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default LoginForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { defineMessages } from '@edx/frontend-platform/i18n'; | ||
|
||
const messages = defineMessages({ | ||
loginFormHeading1: { | ||
id: 'login.form.heading.1', | ||
defaultMessage: 'Login', | ||
description: 'Login form main heading', | ||
}, | ||
loginFormSignInButton: { | ||
id: 'login.form.signin.button.text', | ||
defaultMessage: 'Sign in', | ||
description: 'Sign in button label that appears on login page', | ||
}, | ||
loginFormForgotPasswordButton: { | ||
id: 'login.form.forgot.password.button.text', | ||
defaultMessage: 'Forgot Password?', | ||
description: 'Button text for forgot password', | ||
}, | ||
loginFormRegistrationHelpText: { | ||
id: 'login.form.sign.up.helping.text', | ||
defaultMessage: 'Don’t have an account yet?', | ||
description: 'Sign up link help text', | ||
}, | ||
loginFormRegistrationLink: { | ||
id: 'login.form.sign.up.link.text', | ||
defaultMessage: 'Create an account', | ||
description: 'Text that appears on the registration button', | ||
}, | ||
loginFormEmailFieldLabel: { | ||
id: 'login.form.email.field.text', | ||
defaultMessage: 'Email', | ||
description: 'Email field label', | ||
}, | ||
loginFormPasswordFieldLabel: { | ||
id: 'login.form.password.field.text', | ||
defaultMessage: 'Password', | ||
description: 'Password field label', | ||
}, | ||
loginFormHeading2: { | ||
id: 'login.form.or.message', | ||
defaultMessage: 'or', | ||
description: 'Heading that appears between social auth and basic login form', | ||
}, | ||
}); | ||
|
||
export default messages; |