From 002adfdf7c3fb045631ca30fbced846ad6afbd65 Mon Sep 17 00:00:00 2001 From: leilenah Date: Fri, 23 Dec 2022 16:26:40 -0800 Subject: [PATCH] Re-style login / sign up forms. --- frontend/src/CodalabApp.js | 3 +- frontend/src/components/Login.js | 143 ++++++----- frontend/src/components/SignUp.js | 282 +++++++++++----------- frontend/src/components/SignUpSuccess.jsx | 52 ++++ frontend/src/css/imports.scss | 3 - frontend/src/theme.js | 3 + 6 files changed, 280 insertions(+), 206 deletions(-) create mode 100644 frontend/src/components/SignUpSuccess.jsx diff --git a/frontend/src/CodalabApp.js b/frontend/src/CodalabApp.js index cd4b1cc10..0d62d81ea 100644 --- a/frontend/src/CodalabApp.js +++ b/frontend/src/CodalabApp.js @@ -10,7 +10,8 @@ import UserInfo from './components/UserInfo'; import NavBar from './components/NavBar'; import Footer from './components/Footer'; import Login from './components/Login'; -import { SignUp, SignUpSuccess } from './components/SignUp'; +import SignUp from './components/SignUp'; +import SignUpSuccess from './components/SignUpSuccess'; import { ChangeEmail, ChangeEmailSuccess } from './components/ChangeEmail'; import VerifySuccess from './components/VerifySuccess'; import VerifyError from './components/VerifyError'; diff --git a/frontend/src/components/Login.js b/frontend/src/components/Login.js index 7cfd2b302..e41d7d17a 100644 --- a/frontend/src/components/Login.js +++ b/frontend/src/components/Login.js @@ -1,8 +1,9 @@ import * as React from 'react'; import Immutable from 'seamless-immutable'; import { Redirect, NavLink } from 'react-router-dom'; -import SubHeader from './SubHeader'; -import ContentWrapper from './ContentWrapper'; +import { withStyles } from '@material-ui/core/styles'; +import { Typography } from '@material-ui/core'; +import Button from '@material-ui/core/Button'; import queryString from 'query-string'; class Login extends React.Component { @@ -35,73 +36,91 @@ class Login extends React.Component { render() { const { error } = queryString.parse(this.props.location.search); const pathname = this.props.location.pathname; - + const classes = this.props.classes; let { redirectToReferrer, from } = this.state; if (redirectToReferrer) return ; return ( - - - - {from !== '/' &&

You must log in to view the page at {from}

} - {error &&
{error}
} -
-
- - -
-
- - -
- - - - {/* the above is almost certainly wrong, not sure how to fix*/} -
-

- Don't have an account? Sign up! -

-

- Forgot your password? -

- -
-
+ Sign In + + +

+ Don't have an account? Sign up! +

+

+ Forgot your password? +

+ + ); } } -export default Login; +const styles = (theme) => ({ + loginContainer: { + maxWidth: 315, + margin: '50px auto', + padding: '22px 30px 30px', + borderRadius: 12, + boxShadow: theme.boxShadow.card, + backgroundColor: 'white', + }, + loginBtn: { + marginBottom: 20, + marginTop: 5, + }, +}); + +export default withStyles(styles)(Login); diff --git a/frontend/src/components/SignUp.js b/frontend/src/components/SignUp.js index cfa5a50cc..b4abf3f9d 100644 --- a/frontend/src/components/SignUp.js +++ b/frontend/src/components/SignUp.js @@ -1,9 +1,10 @@ import * as React from 'react'; import { NavLink } from 'react-router-dom'; -import SubHeader from './SubHeader'; -import ContentWrapper from './ContentWrapper'; -import queryString from 'query-string'; import ReCAPTCHA from 'react-google-recaptcha'; +import queryString from 'query-string'; +import { withStyles } from '@material-ui/core/styles'; +import { Typography } from '@material-ui/core'; +import Button from '@material-ui/core/Button'; // Set global properties used by reCaptcha // See: https://www.npmjs.com/package/react-google-recaptcha#global-properties-used-by-recaptcha @@ -12,24 +13,7 @@ window.recaptchaOptions = { useRecaptchaNet: true, }; -export const SignUpSuccess = (props) => { - const { email } = queryString.parse(props.location.search); - return ( - - - -
-
-

Thank you for signing up for a CodaLab account!

-

A link to verify your account has been sent to {email}.

-
-
-
-
- ); -}; - -export class SignUp extends React.Component { +class SignUp extends React.Component { state = { form: {}, captchaPassed: false, @@ -90,127 +74,145 @@ export class SignUp extends React.Component { render() { const { error } = queryString.parse(this.props.location.search); + const classes = this.props.classes; return ( - - - -

- Already have an account? Then please{' '} - sign in. -

-
- {error &&
{error}
} -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- { - this.setState({ captchaPassed: true }); - }} - style={{ marginBottom: 10 }} +
+

+ Already have an account? Sign In. +

+ + Sign Up + + + {error &&
{error}
} +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + - - - - +
+
+ + +
+
+ + +
+ { + this.setState({ captchaPassed: true }); + }} + style={{ marginBottom: 15 }} + /> + + +
); } } + +const styles = (theme) => ({ + signUpContainer: { + maxWidth: 363, + margin: '50px auto', + padding: '22px 30px 30px', + borderRadius: 12, + boxShadow: theme.boxShadow.card, + backgroundColor: 'white', + }, +}); + +export default withStyles(styles)(SignUp); diff --git a/frontend/src/components/SignUpSuccess.jsx b/frontend/src/components/SignUpSuccess.jsx new file mode 100644 index 000000000..7ec312de0 --- /dev/null +++ b/frontend/src/components/SignUpSuccess.jsx @@ -0,0 +1,52 @@ +import React from 'react'; +import queryString from 'query-string'; +import { withStyles } from '@material-ui/core/styles'; +import { Typography } from '@material-ui/core'; + +class SignUpSuccess extends React.Component { + constructor(props) { + super(props); + } + + render() { + const { email } = queryString.parse(this.props.location.search); + const classes = this.props.classes; + return ( +
+
+
🎉
+ + Thank you for signing up for a CodaLab account! + + + A link to verify your account has been sent to {email}. + +
+
+ ); + } +} + +const styles = (theme) => ({ + outterContainer: { + display: 'flex', + justifyContent: 'center', + marginTop: 50, + }, + innerContainer: { + display: 'inline-block', + padding: '15px 30px 22px', + borderRadius: 12, + boxShadow: theme.boxShadow.card, + backgroundColor: 'white', + textAlign: 'center', + }, + subtitle: { + color: theme.color.grey.darkest, + }, + tada: { + fontSize: 72, + }, +}); + +export default withStyles(styles)(SignUpSuccess); diff --git a/frontend/src/css/imports.scss b/frontend/src/css/imports.scss index e5f70063d..727ab23ca 100644 --- a/frontend/src/css/imports.scss +++ b/frontend/src/css/imports.scss @@ -842,7 +842,4 @@ b, strong { transition: all .1s ease-in-out; border-radius: 2px; } -.login button{ - margin-bottom: 15px; -} @import "./overrides.scss"; diff --git a/frontend/src/theme.js b/frontend/src/theme.js index 900d24bd2..19540f4f8 100644 --- a/frontend/src/theme.js +++ b/frontend/src/theme.js @@ -81,4 +81,7 @@ export default createMuiTheme({ }, }, }, + boxShadow: { + card: '0 2px 4px 0 rgba(138, 148, 159, 0.2)', + }, });