From b03a7db836ccf398621f5b37440e2b2ac4f599f3 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 23 May 2022 18:11:22 -0700 Subject: Clean up login screens --- modern/src/login/LoginLayout.js | 2 +- modern/src/login/LoginPage.js | 163 ++++++++++++++++++---------------- modern/src/login/RegisterPage.js | 128 ++++++++++++-------------- modern/src/login/ResetPasswordPage.js | 115 +++++++++++------------- 4 files changed, 193 insertions(+), 215 deletions(-) diff --git a/modern/src/login/LoginLayout.js b/modern/src/login/LoginLayout.js index cfdd837c..4d86d2f6 100644 --- a/modern/src/login/LoginLayout.js +++ b/modern/src/login/LoginLayout.js @@ -63,7 +63,7 @@ const LoginLayout = ({ children }) => {
- { children } + {children}
diff --git a/modern/src/login/LoginPage.js b/modern/src/login/LoginPage.js index cc010427..1d18f2a8 100644 --- a/modern/src/login/LoginPage.js +++ b/modern/src/login/LoginPage.js @@ -1,6 +1,5 @@ import React, { useState } from 'react'; import { - Grid, useMediaQuery, InputLabel, Select, @@ -26,16 +25,29 @@ import usePersistedState from '../common/util/usePersistedState'; const useStyles = makeStyles((theme) => ({ legacy: { - position: 'absolute', + position: 'fixed', top: theme.spacing(1), right: theme.spacing(1), }, + container: { + display: 'flex', + flexDirection: 'column', + gap: theme.spacing(2), + }, logoContainer: { textAlign: 'center', color: theme.palette.primary.main, }, + extraContainer: { + display: 'flex', + gap: theme.spacing(2), + }, + registerButton: { + minWidth: 'unset', + }, resetPassword: { cursor: 'pointer', + textAlign: 'right', }, })); @@ -93,89 +105,82 @@ const LoginPage = () => { - - {useMediaQuery(theme.breakpoints.down('lg')) - && ( - - - - - - )} - - setEmail(e.target.value)} - onKeyUp={handleSpecialKey} - helperText={failed && 'Invalid username or password'} - /> - - - setPassword(e.target.value)} - onKeyUp={handleSpecialKey} - /> - - +
+ {useMediaQuery(theme.breakpoints.down('lg')) && ( +
+ + + +
+ )} + setEmail(e.target.value)} + onKeyUp={handleSpecialKey} + helperText={failed && 'Invalid username or password'} + /> + setPassword(e.target.value)} + onKeyUp={handleSpecialKey} + /> + +
- - - - - - - - {t('loginLanguage')} - - - - + + {t('loginLanguage')} + + +
{emailEnabled && ( - - - navigate('/reset-password')} className={classes.resetPassword} underline="none">{t('loginReset')} - - + navigate('/reset-password')} + className={classes.resetPassword} + underline="none" + > + {t('loginReset')} + )} - setAnnouncementShown(true)}> - - - )} - /> - +
+ setAnnouncementShown(true)}> + + + )} + /> ); }; diff --git a/modern/src/login/RegisterPage.js b/modern/src/login/RegisterPage.js index 986bf894..08ff3e8f 100644 --- a/modern/src/login/RegisterPage.js +++ b/modern/src/login/RegisterPage.js @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { - Grid, Button, TextField, Typography, Link, Snackbar, + Button, TextField, Typography, Snackbar, IconButton, } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import { useNavigate } from 'react-router-dom'; @@ -11,18 +11,21 @@ import { snackBarDurationShortMs } from '../common/util/duration'; import { useCatch } from '../reactHelper'; const useStyles = makeStyles((theme) => ({ + container: { + display: 'flex', + flexDirection: 'column', + gap: theme.spacing(2), + }, + header: { + display: 'flex', + alignItems: 'center', + }, title: { fontSize: theme.spacing(3), fontWeight: 500, - marginLeft: theme.spacing(2), + marginLeft: theme.spacing(1), textTransform: 'uppercase', }, - link: { - fontSize: theme.spacing(3), - fontWeight: 500, - marginTop: theme.spacing(0.5), - cursor: 'pointer', - }, })); const RegisterPage = () => { @@ -50,75 +53,58 @@ const RegisterPage = () => { return ( +
+
+ navigate('/login')}> + + + + {t('loginRegister')} + +
+ setName(event.target.value)} + /> + setEmail(event.target.value)} + /> + setPassword(event.target.value)} + /> + +
navigate('/login')} autoHideDuration={snackBarDurationShortMs} message={t('loginCreated')} /> - - - - - navigate('/login')}> - - - - - - - {t('loginRegister')} - - - - - setName(event.target.value)} - /> - - - setEmail(event.target.value)} - /> - - - setPassword(event.target.value)} - /> - - - - -
); }; diff --git a/modern/src/login/ResetPasswordPage.js b/modern/src/login/ResetPasswordPage.js index c3e91fe6..f2f1a132 100644 --- a/modern/src/login/ResetPasswordPage.js +++ b/modern/src/login/ResetPasswordPage.js @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { - Grid, Button, TextField, Typography, Link, Snackbar, + Button, TextField, Typography, Snackbar, IconButton, } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import { useNavigate } from 'react-router-dom'; @@ -12,18 +12,21 @@ import { snackBarDurationShortMs } from '../common/util/duration'; import { useCatch } from '../reactHelper'; const useStyles = makeStyles((theme) => ({ + container: { + display: 'flex', + flexDirection: 'column', + gap: theme.spacing(2), + }, + header: { + display: 'flex', + alignItems: 'center', + }, title: { fontSize: theme.spacing(3), fontWeight: 500, - marginLeft: theme.spacing(2), + marginLeft: theme.spacing(1), textTransform: 'uppercase', }, - link: { - fontSize: theme.spacing(3), - fontWeight: 500, - marginTop: theme.spacing(0.5), - cursor: 'pointer', - }, })); const ResetPasswordPage = () => { @@ -61,68 +64,52 @@ const ResetPasswordPage = () => { return ( +
+
+ navigate('/login')}> + + + + {t('loginReset')} + +
+ {!token ? ( + setEmail(event.target.value)} + /> + ) : ( + setPassword(event.target.value)} + /> + )} + +
navigate('/login')} autoHideDuration={snackBarDurationShortMs} message={!token ? t('loginResetSuccess') : t('loginUpdateSuccess')} /> - - - - - navigate('/login')}> - - - - - - - {t('loginReset')} - - - - {!token - ? ( - - setEmail(event.target.value)} - /> - - ) - : ( - - setPassword(event.target.value)} - /> - - )} - - - -
); }; -- cgit v1.2.3