Changed styles for Login page (#316)

Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
Co-authored-by: Daniel Valdivia <hola@danielvaldivia.com>
This commit is contained in:
Alex
2020-10-06 18:37:25 -05:00
committed by GitHub
parent f91346dc5b
commit 7166717688
3 changed files with 228 additions and 179 deletions

File diff suppressed because one or more lines are too long

View File

@@ -18,6 +18,7 @@ import React, { useEffect, useState } from "react";
import request from "superagent"; import request from "superagent";
import storage from "local-storage-fallback"; import storage from "local-storage-fallback";
import { connect, ConnectedProps } from "react-redux"; import { connect, ConnectedProps } from "react-redux";
import ErrorIcon from "@material-ui/icons/Error";
import Button from "@material-ui/core/Button"; import Button from "@material-ui/core/Button";
import TextField from "@material-ui/core/TextField"; import TextField from "@material-ui/core/TextField";
import Grid from "@material-ui/core/Grid"; import Grid from "@material-ui/core/Grid";
@@ -30,22 +31,31 @@ import api from "../../common/api";
import { ILoginDetails, loginStrategyType } from "./types"; import { ILoginDetails, loginStrategyType } from "./types";
import { setSession } from "../../common/utils"; import { setSession } from "../../common/utils";
import history from "../../history"; import history from "../../history";
import { Error } from "@material-ui/icons";
const styles = (theme: Theme) => const styles = (theme: Theme) =>
createStyles({ createStyles({
"@global": { "@global": {
body: { body: {
backgroundColor: "#F4F4F4", backgroundColor: "#FAFAFA",
}, },
}, },
paper: { paper: {
marginTop: theme.spacing(16), borderRadius: 8,
borderRadius: "3px",
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
alignItems: "center", alignItems: "center",
width: "800px", width: 800,
height: 424,
margin: "auto", margin: "auto",
position: "absolute",
top: "50%",
left: "50%",
marginLeft: -400,
marginTop: -212,
"&.MuiPaper-root": {
borderRadius: 8,
},
}, },
avatar: { avatar: {
margin: theme.spacing(1), margin: theme.spacing(1),
@@ -53,36 +63,67 @@ const styles = (theme: Theme) =>
}, },
form: { form: {
width: "100%", // Fix IE 11 issue. width: "100%", // Fix IE 11 issue.
marginTop: theme.spacing(3),
}, },
submit: { submit: {
margin: theme.spacing(3, 0, 2), margin: "30px 0px 16px",
height: 40,
fontWeight: 700,
boxShadow: "none",
padding: "16px 30px",
}, },
errorBlock: { errorBlock: {
color: "red", backgroundColor: "#C72C48",
width: 800,
height: 64,
display: "flex",
justifyContent: "center",
alignItems: "center",
position: "absolute",
left: "50%",
top: "50%",
marginLeft: -400,
marginTop: -290,
color: "#fff",
fontWeight: 700,
fontSize: 14,
borderRadius: 8,
}, },
mainContainer: { mainContainer: {
borderRadius: "3px", position: "relative",
height: 424,
}, },
theOcean: { theOcean: {
borderTopLeftRadius: "3px", borderTopLeftRadius: 8,
borderBottomLeftRadius: "3px", borderBottomLeftRadius: 8,
background: background:
"transparent linear-gradient(333deg, #281B6F 1%, #271260 13%, #120D53 83%) 0% 0% no-repeat padding-box;", "transparent linear-gradient(to bottom, #073052 0%,#05122b 100%); 0% 0% no-repeat padding-box;",
}, },
oceanBg: { oceanBg: {
backgroundImage: "url(/images/BG_Illustration.svg)", backgroundImage: "url(/images/BG_Illustration.svg)",
backgroundRepeat: "no-repeat", backgroundRepeat: "no-repeat",
backgroundPosition: "bottom left", backgroundPosition: "bottom left",
height: "100%", height: "100%",
width: "100%", width: 324,
}, },
theLogin: { theLogin: {
padding: "76px 62px 20px 62px", padding: "40px 45px 20px 45px",
}, },
loadingLoginStrategy: { loadingLoginStrategy: {
textAlign: "center", textAlign: "center",
}, },
headerTitle: {
marginBottom: 10,
},
submitContainer: {
textAlign: "right",
},
disclaimer: {
fontSize: 12,
marginTop: 30,
},
jwtInput: {
marginTop: 45,
},
}); });
const mapState = (state: SystemState) => ({ const mapState = (state: SystemState) => ({
@@ -182,61 +223,59 @@ const Login = ({ classes, userLoggedIn }: ILoginProps) => {
case loginStrategyType.form: { case loginStrategyType.form: {
loginComponent = ( loginComponent = (
<React.Fragment> <React.Fragment>
<Typography component="h1" variant="h6"> <Typography
Login component="h1"
variant="h6"
className={classes.headerTitle}
>
Console Login
</Typography> </Typography>
<form className={classes.form} noValidate onSubmit={formSubmit}> <form className={classes.form} noValidate onSubmit={formSubmit}>
<Grid container spacing={2}> <Grid container spacing={2}>
{error !== "" && (
<Grid item xs={12}>
<Typography
component="p"
variant="body1"
className={classes.errorBlock}
>
{error}
</Typography>
</Grid>
)}
<Grid item xs={12}> <Grid item xs={12}>
<TextField <TextField
required
fullWidth fullWidth
id="accessKey" id="accessKey"
value={accessKey} value={accessKey}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
setAccessKey(e.target.value) setAccessKey(e.target.value)
} }
label="Access Key" label="Enter Access Key"
name="accessKey" name="accessKey"
autoComplete="username" autoComplete="username"
/> />
</Grid> </Grid>
<Grid item xs={12}> <Grid item xs={12}>
<TextField <TextField
required
fullWidth fullWidth
value={secretKey} value={secretKey}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
setSecretKey(e.target.value) setSecretKey(e.target.value)
} }
name="secretKey" name="secretKey"
label="Secret Key" label="Enter Secret Key"
type="password" type="password"
id="secretKey" id="secretKey"
autoComplete="current-password" autoComplete="current-password"
/> />
</Grid> </Grid>
</Grid> </Grid>
<Button <Grid item xs={12} className={classes.submitContainer}>
type="submit" <Button
fullWidth type="submit"
variant="contained" variant="contained"
color="primary" color="primary"
className={classes.submit} className={classes.submit}
> >
Login Login
</Button> </Button>
</Grid>
<Grid item xs={12} className={classes.disclaimer}>
<strong>Don't have an access key?</strong>
<br />
<br />
Contact your administrator to have one made
</Grid>
</form> </form>
</React.Fragment> </React.Fragment>
); );
@@ -245,7 +284,11 @@ const Login = ({ classes, userLoggedIn }: ILoginProps) => {
case loginStrategyType.redirect: { case loginStrategyType.redirect: {
loginComponent = ( loginComponent = (
<React.Fragment> <React.Fragment>
<Typography component="h1" variant="h6"> <Typography
component="h1"
variant="h6"
className={classes.headerTitle}
>
Login Login
</Typography> </Typography>
<Button <Button
@@ -255,7 +298,6 @@ const Login = ({ classes, userLoggedIn }: ILoginProps) => {
window.location.hostname window.location.hostname
)} )}
type="submit" type="submit"
fullWidth
variant="contained" variant="contained"
color="primary" color="primary"
className={classes.submit} className={classes.submit}
@@ -269,23 +311,16 @@ const Login = ({ classes, userLoggedIn }: ILoginProps) => {
case loginStrategyType.serviceAccount: { case loginStrategyType.serviceAccount: {
loginComponent = ( loginComponent = (
<React.Fragment> <React.Fragment>
<Typography component="h1" variant="h6"> <Typography
Login component="h1"
variant="h6"
className={classes.headerTitle}
>
Operator Login
</Typography> </Typography>
<form className={classes.form} noValidate onSubmit={formSubmit}> <form className={classes.form} noValidate onSubmit={formSubmit}>
<Grid container spacing={2}> <Grid container spacing={2}>
{error !== "" && ( <Grid item xs={12} className={classes.jwtInput}>
<Grid item xs={12}>
<Typography
component="p"
variant="body1"
className={classes.errorBlock}
>
{error}
</Typography>
</Grid>
)}
<Grid item xs={12}>
<TextField <TextField
required required
fullWidth fullWidth
@@ -300,15 +335,21 @@ const Login = ({ classes, userLoggedIn }: ILoginProps) => {
/> />
</Grid> </Grid>
</Grid> </Grid>
<Button <Grid item xs={12} className={classes.submitContainer}>
type="submit" <Button
fullWidth type="submit"
variant="contained" variant="contained"
color="primary" color="primary"
className={classes.submit} className={classes.submit}
> >
Login Login
</Button> </Button>
</Grid>
<Grid item xs={12} className={classes.disclaimer}>
<strong>Don't have an access key?</strong>
<br />
Contact your administrator to have one made
</Grid>
</form> </form>
</React.Fragment> </React.Fragment>
); );
@@ -321,16 +362,24 @@ const Login = ({ classes, userLoggedIn }: ILoginProps) => {
} }
return ( return (
<Paper className={classes.paper}> <React.Fragment>
<Grid container className={classes.mainContainer}> {error !== "" && (
<Grid item xs={7} className={classes.theOcean}> <div className={classes.errorBlock}>
<div className={classes.oceanBg} /> <ErrorIcon fontSize="small" />
&nbsp;{error}
</div>
)}
<Paper className={classes.paper}>
<Grid container className={classes.mainContainer}>
<Grid item xs={7} className={classes.theOcean}>
<div className={classes.oceanBg} />
</Grid>
<Grid item xs={5} className={classes.theLogin}>
{loginComponent}
</Grid>
</Grid> </Grid>
<Grid item xs={5} className={classes.theLogin}> </Paper>
{loginComponent} </React.Fragment>
</Grid>
</Grid>
</Paper>
); );
}; };

View File

@@ -3,9 +3,9 @@ import { createMuiTheme } from "@material-ui/core";
const theme = createMuiTheme({ const theme = createMuiTheme({
palette: { palette: {
primary: { primary: {
light: "#757ce8", light: "#073052",
main: "#201763", main: "#081C42",
dark: "#362585", dark: "#05122B",
contrastText: "#fff", contrastText: "#fff",
}, },
secondary: { secondary: {
@@ -38,15 +38,15 @@ const theme = createMuiTheme({
fontFamily: ["Lato", "sans-serif"].join(","), fontFamily: ["Lato", "sans-serif"].join(","),
h1: { h1: {
fontWeight: "bold", fontWeight: "bold",
color: "#201763", color: "#081C42",
}, },
h2: { h2: {
fontWeight: "bold", fontWeight: "bold",
color: "#201763", color: "#081C42",
}, },
h3: { h3: {
fontWeight: "bold", fontWeight: "bold",
color: "#201763", color: "#081C42",
}, },
h4: { h4: {
fontWeight: "bold", fontWeight: "bold",
@@ -54,7 +54,7 @@ const theme = createMuiTheme({
}, },
h5: { h5: {
fontWeight: "bold", fontWeight: "bold",
color: "#201763", color: "#081C42",
}, },
h6: { h6: {
fontWeight: "bold", fontWeight: "bold",