Restructured login page

This commit is contained in:
Daniel Cojocea committed 2024-07-15 18:14:20 -04:00
1 parent 797eacee22
commit 5fbf5caec4
4 files changed
+111 -106

No files matched your search

+4
View File
@@ -63,6 +63,10 @@ const Button = ({ id, type, level, label, disabled, img, onClick, sx }) => {
"&:focus": { "&:focus": {
outline: "none", outline: "none",
}, },
"& .MuiTouchRipple-root": {
pointerEvents: "none",
display: "none",
},
...sx, ...sx,
}} }}
> >
+41 -61
View File
@@ -3,78 +3,58 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
min-height: var(--env-var-height-1); height: 100vh;
} }
.login-page svg rect {
.login-form { fill: none;
width: var(--env-var-width-2);
margin: 90px auto;
} }
.login-page h1.MuiTypography-root {
.login-form-header { font-size: 30px;
justify-content: center; font-weight: 600;
align-items: center;
text-align: center;
}
#login-form-header-logo {
margin-bottom: 60px;
}
.login-form-v-spacing {
height: var(--env-var-spacing-1);
}
.login-form-v2-spacing {
height: var(--env-var-spacing-2);
}
.login-form-v3-spacing {
height: var(--env-var-spacing-3);
}
.login-form-heading {
font-size: var(--env-var-font-size-xlarge);
font-weight: 700;
color: var(--env-var-color-1); color: var(--env-var-color-1);
} }
.login-page p.MuiTypography-root,
.login-page span,
.login-page button {
font-size: var(--env-var-font-size-medium);
}
.login-page p.MuiTypography-root {
color: var(--env-var-color-2);
opacity: 0.8;
}
.login-page button {
height: 34px;
border-radius: var(--env-var-radius-2);
line-height: 0;
}
.login-page span:not(.MuiTypography-root):not(.MuiButtonBase-root) {
color: var(--env-var-color-3);
cursor: pointer;
font-weight: 600;
}
.login-page .MuiFormControlLabel-root {
margin: 0;
}
.login-page .MuiFormControlLabel-root .MuiButtonBase-root {
margin-right: 5px;
}
.login-page .MuiFormControlLabel-root span:not(.Mui-checked) svg{
fill: var(--env-var-color-4);
}
.login-page .MuiFormControlLabel-root svg{
margin-bottom: 1px;
}
.login-page .MuiFormControlLabel-root .MuiTypography-root {
color: var(--env-var-color-5);
user-select: none;
}
/* .login-form-inputs .field h3.MuiTypography-root{ /* .login-form-inputs .field h3.MuiTypography-root{
font-weight: 600; font-weight: 600;
} */ } */
.login-form-password-options {
display: flex;
align-items: center;
justify-content: space-between;
}
.login-form-forgot-password {
color: var(--env-var-color-3);
font-weight: 600;
cursor: pointer;
font-size: var(--env-var-font-size-medium);
}
.google-enter { .google-enter {
width: var(--env-var-img-width-1); width: var(--env-var-img-width-1);
height: var(--env-var-img-width-1); height: var(--env-var-img-width-1);
margin-right: 10px; margin-right: 10px;
} }
.new-account-option {
display: flex;
justify-content: center;
align-items: center;
color: var(--env-var-color-2);
font-size: var(--env-var-font-size-medium);
font-weight: 600;
}
.new-account-option-span {
margin-left: 5px;
color: var(--env-var-color-3);
font-size: var(--env-var-font-size-medium);
cursor: pointer;
font-weight: 700;
}
+65 -45
View File
@@ -8,15 +8,24 @@ import CheckBox from "../../Components/Checkbox/Checkbox";
import Button from "../../Components/Button"; import Button from "../../Components/Button";
import Google from "../../assets/Images/Google.png"; import Google from "../../assets/Images/Google.png";
import axiosInstance from "../../Utils/axiosConfig"; import axiosInstance from "../../Utils/axiosConfig";
import { loginValidation, credentials } from "../../Validation/validation"; import { credentials } from "../../Validation/validation";
import { login } from "../../Features/Auth/authSlice"; import { login } from "../../Features/Auth/authSlice";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
import { createToast } from "../../Utils/toastUtils"; import { createToast } from "../../Utils/toastUtils";
import Field from "../../Components/Inputs/Field"; import Field from "../../Components/Inputs/Field";
import {
Checkbox,
Divider,
FormControlLabel,
Stack,
Typography,
} from "@mui/material";
import { useTheme } from "@emotion/react";
const Login = () => { const Login = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const navigate = useNavigate(); const navigate = useNavigate();
const theme = useTheme();
const idMap = { const idMap = {
"login-email-input": "email", "login-email-input": "email",
@@ -115,15 +124,22 @@ const Login = () => {
return ( return (
<div className="login-page"> <div className="login-page">
<BackgroundPattern></BackgroundPattern> <BackgroundPattern></BackgroundPattern>
<form className="login-form" onSubmit={handleSubmit}> <form
<div className="login-form-header"> className="login-form"
<Logomark id="login-form-header-logo" alt="Logomark" /> onSubmit={handleSubmit}
<div className="login-form-v-spacing" /> style={{ marginBottom: theme.gap.xxl }}
<div className="login-form-heading">Log in to your account</div> >
</div> <Stack gap={theme.gap.large} direction="column">
<div className="login-form-v3-spacing" /> <Logomark alt="Logomark" />
<Button
<div className="login-form-inputs"> level="secondary"
label="Sign in with Google"
sx={{ fontWeight: "600", mt: theme.gap.xxl }}
img={<img className="google-enter" src={Google} alt="Google" />}
/>
<Divider>
<Typography>or</Typography>
</Divider>
<Field <Field
type="email" type="email"
id="login-email-input" id="login-email-input"
@@ -135,52 +151,56 @@ const Login = () => {
onChange={handleChange} onChange={handleChange}
error={errors.email} error={errors.email}
/> />
<div className="login-form-v2-spacing" />
<Field <Field
type="password" type="password"
id="login-password-input" id="login-password-input"
label="Password" label="Password"
isRequired={true} isRequired={true}
placeholder="Enter your password" placeholder="••••••••••"
autoComplete="current-password" autoComplete="current-password"
value={form.password} value={form.password}
onChange={handleChange} onChange={handleChange}
error={errors.password} error={errors.password}
/> />
</div> <Stack direction="row" justifyContent="space-between">
<div className="login-form-v3-spacing" /> <FormControlLabel
<div className="login-form-password-options"> control={
<CheckBox /> <Checkbox
<div className="login-form-forgot-password">Forgot password</div> size="small"
</div> sx={{
<div className="login-form-v3-spacing" /> padding: 0,
<div className="login-form-actions"> "& .MuiTouchRipple-root": {
<Button pointerEvents: "none",
type="submit" display: "none",
level="primary" },
label="Sign in" }}
sx={{ width: "100%" }} />
/> }
<div className="login-form-v-spacing" /> label="Remember me"
<Button />
level="secondary" <span>Forgot password</span>
label="Sign in with Google" </Stack>
sx={{ width: "100%", color: "#344054", fontWeight: "700" }} </Stack>
img={<img className="google-enter" src={Google} alt="Google" />} <Stack gap={theme.gap.ml} mt={theme.gap.large}>
/> <Button type="submit" level="primary" label="Sign in" />
</div> <Stack
<div className="login-form-v3-spacing" /> direction="row"
<div className="new-account-option"> justifyContent="center"
Don’t have an account? gap="5px"
<span mt={theme.gap.ml}
onClick={() => {
navigate("/register");
}}
className="new-account-option-span"
> >
Sign up <Typography component="p" sx={{ alignSelf: "center" }}>
</span> Don't have an account?
</div> </Typography>
<span
onClick={() => {
navigate("/register");
}}
>
Sign up
</span>
</Stack>
</Stack>
</form> </form>
</div> </div>
); );
+1
View File
@@ -97,6 +97,7 @@ const theme = createTheme({
ml: "16px", ml: "16px",
large: "24px", large: "24px",
xl: "40px", xl: "40px",
xxl: "60px",
}, },
alert: { alert: {
info: { info: {