From 796c7e4cdb8418f40cbc2217e1588c913c305b92 Mon Sep 17 00:00:00 2001 From: Waheed Ahmed Date: Wed, 6 Jan 2021 13:43:58 +0500 Subject: [PATCH] Fix max-width issue with social auth buttons. (#70) VAN-222 --- src/logistration/LoginPage.jsx | 186 +- src/logistration/RegistrationPage.jsx | 252 +-- .../__snapshots__/LoginPage.test.jsx.snap | 1402 ++++++------- .../RegistrationPage.test.jsx.snap | 1742 +++++++++-------- 4 files changed, 1813 insertions(+), 1769 deletions(-) diff --git a/src/logistration/LoginPage.jsx b/src/logistration/LoginPage.jsx index b770fed2..0d281775 100644 --- a/src/logistration/LoginPage.jsx +++ b/src/logistration/LoginPage.jsx @@ -142,99 +142,101 @@ class LoginPage extends React.Component { />
- {thirdPartyAuthContext.currentProvider - && ( - - )} - {this.props.loginError ? : null} - {this.props.forgotPassword.status === 'complete' ? : null} -
-

- {intl.formatMessage(messages['logistration.first.time.here'])} - - {intl.formatMessage(messages['logistration.create.an.account'])}. - -

+
+ {thirdPartyAuthContext.currentProvider + && ( + + )} + {this.props.loginError ? : null} + {this.props.forgotPassword.status === 'complete' ? : null} +
+

+ {intl.formatMessage(messages['logistration.first.time.here'])} + + {intl.formatMessage(messages['logistration.create.an.account'])}. + +

+
+

+ {intl.formatMessage(messages['logistration.login.institution.login.sign.in'])} +

+ {thirdPartyAuthContext.secondaryProviders.length ? ( + <> + +
+

{intl.formatMessage(messages['logistration.or.sign.in.with'])}

+
+ + ) : null } +
+ + + {intl.formatMessage(messages['logistration.login.page.email.label'])} + + this.handleOnChange(e)} + /> +

{intl.formatMessage(messages['logistration.email.help.message'])}

+
+ + + {intl.formatMessage(messages['logistration.password'])} + + this.handleOnChange(e)} + /> + + + + {intl.formatMessage(messages['logistration.enterprise.login.link.text'])} + + + + {thirdPartyAuthContext.providers.length && !thirdPartyAuthContext.currentProvider ? ( + <> +
+

{intl.formatMessage(messages['logistration.or.sign.in.with'])}

+
+
+ +
+ + ) : null}
-

- {intl.formatMessage(messages['logistration.login.institution.login.sign.in'])} -

- {thirdPartyAuthContext.secondaryProviders.length ? ( - <> - -
-

{intl.formatMessage(messages['logistration.or.sign.in.with'])}

-
- - ) : null } -
- - - {intl.formatMessage(messages['logistration.login.page.email.label'])} - - this.handleOnChange(e)} - /> -

{intl.formatMessage(messages['logistration.email.help.message'])}

-
- - - {intl.formatMessage(messages['logistration.password'])} - - this.handleOnChange(e)} - /> - - - - {intl.formatMessage(messages['logistration.enterprise.login.link.text'])} - - - - {thirdPartyAuthContext.providers.length && !thirdPartyAuthContext.currentProvider ? ( - <> -
-

{intl.formatMessage(messages['logistration.or.sign.in.with'])}

-
-
- -
- - ) : null}
diff --git a/src/logistration/RegistrationPage.jsx b/src/logistration/RegistrationPage.jsx index dd5dbec9..34bc6494 100644 --- a/src/logistration/RegistrationPage.jsx +++ b/src/logistration/RegistrationPage.jsx @@ -448,144 +448,146 @@ class RegistrationPage extends React.Component { />
- {this.renderErrors()} - {currentProvider && ( - - )} -
- {intl.formatMessage(messages['logistration.already.have.an.edx.account'])} - {intl.formatMessage(messages['logistration.sign.in.hyperlink'])} -
- {(providers.length || secondaryProviders.length) && !currentProvider ? ( -
- - {intl.formatMessage(messages['logistration.create.an.account.using'])} - -
- -
- + {this.renderErrors()} + {currentProvider && ( + - - {intl.formatMessage(messages['logistration.create.a.new.one.here'])} - + )} +
+ {intl.formatMessage(messages['logistration.already.have.an.edx.account'])} + {intl.formatMessage(messages['logistration.sign.in.hyperlink'])}
- ) : null} -
- - - this.handleOnChange(e)} - onBlur={e => this.handleOnBlur(e)} - required - /> - - - - this.handleOnChange(e)} - onBlur={e => this.handleOnBlur(e)} - required - /> - - - - this.handleOnChange(e)} - onBlur={e => this.handleOnBlur(e)} - required - /> - - {!currentProvider && ( + {(providers.length || secondaryProviders.length) && !currentProvider ? ( +
+ + {intl.formatMessage(messages['logistration.create.an.account.using'])} + +
+ +
+ + + {intl.formatMessage(messages['logistration.create.a.new.one.here'])} + +
+ ) : null} + - - )} - { this.addExtraRequiredFields() } - - this.handleOnOptional(e)} - required + + + this.handleOnChange(e)} + onBlur={e => this.handleOnBlur(e)} + required + /> + + + + this.handleOnChange(e)} + onBlur={e => this.handleOnBlur(e)} + required + /> + + {!currentProvider && ( + + + this.handleOnChange(e)} + onBlur={e => this.handleOnBlur(e)} + required + /> + + )} + { this.addExtraRequiredFields() } + + this.handleOnOptional(e)} + required + /> + + + { this.state.enableOptionalField ? this.addExtraOptionalFields() : null} + - - - { this.state.enableOptionalField ? this.addExtraOptionalFields() : null} - - + +
diff --git a/src/logistration/tests/__snapshots__/LoginPage.test.jsx.snap b/src/logistration/tests/__snapshots__/LoginPage.test.jsx.snap index 8fd13f12..41af41d9 100644 --- a/src/logistration/tests/__snapshots__/LoginPage.test.jsx.snap +++ b/src/logistration/tests/__snapshots__/LoginPage.test.jsx.snap @@ -8,179 +8,183 @@ exports[`LoginPage should match TPA provider snapshot 1`] = ` className="d-flex flex-column" >
-

- First time here? - - Create an Account - . - -

-
-

- Sign In -

-
- - -

- The email address you used to register with edX. +

+ First time here? + + Create an Account + . +

- - The email address you've provided isn't formatted correctly. -
-
- - - - Please enter your password. - -
- -
+
+ + +

+ The email address you used to register with edX. +

+ + The email address you've provided isn't formatted correctly. + +
+
+ + + + Please enter your password. + +
+ +
-
- - Sign in with your company or school - - - -
-

- or sign in with -

-
-
- + Sign in with your company or school + + + +
+

+ or sign in with +

+
+
+ +
@@ -194,146 +198,150 @@ exports[`LoginPage should match default section snapshot 1`] = ` className="d-flex flex-column" >
-

- First time here? - - Create an Account - . - -

-
-

- Sign In -

-
- - -

- The email address you used to register with edX. +

+ First time here? + + Create an Account + . +

- - The email address you've provided isn't formatted correctly. -
-
- - - - Please enter your password. - -
- -
+
+ + +

+ The email address you used to register with edX. +

+ + The email address you've provided isn't formatted correctly. + +
+
+ + + + Please enter your password. + +
+ +
-
- - Sign in with your company or school - - - +
+
+ + Sign in with your company or school + + + +
`; @@ -346,146 +354,150 @@ exports[`LoginPage should match forget password alert message snapshot 1`] = ` className="d-flex flex-column" >
-

- First time here? - - Create an Account - . - -

-
-

- Sign In -

-
- - -

- The email address you used to register with edX. +

+ First time here? + + Create an Account + . +

- - The email address you've provided isn't formatted correctly. -
-
- - - - Please enter your password. - -
- -
+
+ + +

+ The email address you used to register with edX. +

+ + The email address you've provided isn't formatted correctly. + +
+
+ + + + Please enter your password. + +
+ +
-
- - Sign in with your company or school - - - +
+
+ + Sign in with your company or school + + + +
`; @@ -498,155 +510,159 @@ exports[`LoginPage should match pending button state snapshot 1`] = ` className="d-flex flex-column" >
-

- First time here? - - Create an Account - . - -

-
-

- Sign In -

-
- - -

- The email address you used to register with edX. +

+ First time here? + + Create an Account + . +

- - The email address you've provided isn't formatted correctly. -
-
- - - - Please enter your password. - -
- -
+
+ + +

+ The email address you used to register with edX. +

+ + The email address you've provided isn't formatted correctly. + +
+
+ + + + Please enter your password. + +
+ +
-
- - Sign in with your company or school - - - + + +
`; @@ -659,163 +675,167 @@ exports[`LoginPage should show error message 1`] = ` className="d-flex flex-column" >
- - We couldn't sign you in. - -
- -
-
-

- First time here? - - Create an Account - . - -

-
-

- Sign In -

-
-
- - -

- The email address you used to register with edX. -

- - The email address you've provided isn't formatted correctly. - -
-
- - - - Please enter your password. - -
- -
+ + We couldn't sign you in. + +
+
    +
  • + Email or password is incorrect. +
  • +
+
+
+

+ First time here? + + Create an Account + . + +

+
+

+ Sign In +

+ +
+ + +

+ The email address you used to register with edX. +

+ + The email address you've provided isn't formatted correctly. + +
+
+ + + + Please enter your password. + +
+ +
-
- - Sign in with your company or school - - -
+
+
+ + Sign in with your company or school + + + + `; diff --git a/src/logistration/tests/__snapshots__/RegistrationPage.test.jsx.snap b/src/logistration/tests/__snapshots__/RegistrationPage.test.jsx.snap index 7a354fb5..e38d2ccf 100644 --- a/src/logistration/tests/__snapshots__/RegistrationPage.test.jsx.snap +++ b/src/logistration/tests/__snapshots__/RegistrationPage.test.jsx.snap @@ -8,162 +8,166 @@ exports[`./RegistrationPage.js should display no password field when current pro className="d-flex flex-column" > -
- - Already have an edX account? - - - Sign in. - -
-
-
- - -
-
- - -
-
- - I agree to the Your Platform Name Here - - Honor Code - - - - You must agree to the Your Platform Name Here Honor Code - -
-
- - -
- -
+ +
+ + Already have an edX account? + + + Sign in. + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + I agree to the Your Platform Name Here + + Honor Code + + + + You must agree to the Your Platform Name Here Honor Code + +
+
+ + +
+ +
+ `; @@ -176,215 +180,219 @@ exports[`./RegistrationPage.js should match TPA provider snapshot 1`] = ` className="d-flex flex-column" >
- - Already have an edX account? - - - Sign in. - -
-
- - Create an account using -
+ + Already have an edX account? + + + Sign in. + +
+
+ + Create an account using + +
+ +
+ + or create a new one here + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + I agree to the Your Platform Name Here + + Honor Code + + + + You must agree to the Your Platform Name Here Honor Code + +
+
+ + +
-
- - or create a new one here - + -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - I agree to the Your Platform Name Here - - Honor Code - - - - You must agree to the Your Platform Name Here Honor Code - -
-
- - -
- -
`; @@ -397,175 +405,179 @@ exports[`./RegistrationPage.js should match default section snapshot 1`] = ` className="d-flex flex-column" >
- - Already have an edX account? - - - Sign in. - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - I agree to the Your Platform Name Here - - Honor Code - - - - You must agree to the Your Platform Name Here Honor Code - -
-
- - -
- -
+ + Sign in. + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + I agree to the Your Platform Name Here + + Honor Code + + + + You must agree to the Your Platform Name Here Honor Code + +
+
+ + +
+ +
+ `; @@ -578,184 +590,188 @@ exports[`./RegistrationPage.js should match pending button state snapshot 1`] = className="d-flex flex-column" >
- - Already have an edX account? - - - Sign in. - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - I agree to the Your Platform Name Here + + Already have an edX account? + - Honor Code + Sign in. - - - You must agree to the Your Platform Name Here Honor Code -
-
- -

+ + +

+
+ + +
+
+ + +
+
+ + +
+
+ + I agree to the Your Platform Name Here + + Honor Code + + + + You must agree to the Your Platform Name Here Honor Code + +
+
+ + +
+ -
+ + + `; @@ -768,201 +784,205 @@ exports[`./RegistrationPage.js should show error message on 409 1`] = ` className="d-flex flex-column" >
+
+ + We couldn't create your account. + +
+
+
    +
  • + It looks like test@gmail.com belongs to an existing account. Try again with a different email address. +
  • +
  • + It looks like test belongs to an existing account. Try again with a different username. +
  • +
+
+
+
- We couldn't create your account. + Already have an edX account? -
-
-
    -
  • - It looks like test@gmail.com belongs to an existing account. Try again with a different email address. -
  • -
  • - It looks like test belongs to an existing account. Try again with a different username. -
  • -
-
-
-
- - Already have an edX account? - - - Sign in. - -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - I agree to the Your Platform Name Here - Honor Code + Sign in. - - - You must agree to the Your Platform Name Here Honor Code -
-
- -

+ + +

+
+ + +
+
+ + +
+
+ + +
+
+ + I agree to the Your Platform Name Here + + Honor Code + + + + You must agree to the Your Platform Name Here Honor Code + +
+
+ + +
+ -
+ + Create Account + + + + `;