11import React , { FC , FormEvent } from "react" ;
2- import Avatar from '@material-ui/core/Avatar' ;
3- import LockOutlinedIcon from '@material-ui/icons/LockOutlined'
42import { Navigate , Link , useSearchParams } from "react-router-dom" ;
53import { TextField , Button , Typography } from "@material-ui/core" ;
64import Grid from '@material-ui/core/Grid' ;
75import ApiSingleton from "../../api/ApiSingleton" ;
86import "./Styles/Login.css" ;
97import { useState } from "react" ;
10- import { LoginViewModel } from "../../ api/ "
8+ import { LoginViewModel } from "@/ api"
119import { makeStyles } from '@material-ui/core/styles' ;
1210import Container from '@material-ui/core/Container' ;
1311import ValidationUtils from "../Utils/ValidationUtils" ;
14- import { Card , CardContent } from "@mui/material" ;
12+ import { Alert , Card , CardContent , Stack } from "@mui/material" ;
1513import { DotLottieReact } from "@lottiefiles/dotlottie-react" ;
1614
1715interface LoginProps {
@@ -26,11 +24,6 @@ interface ILoginState {
2624}
2725
2826const useStyles = makeStyles ( ( theme ) => ( {
29- paper : {
30- display : 'flex' ,
31- flexDirection : 'column' ,
32- alignItems : 'center' ,
33- } ,
3427 login : {
3528 marginTop : '16px' ,
3629 width : '100%' ,
@@ -47,11 +40,6 @@ const useStyles = makeStyles((theme) => ({
4740 } ,
4841 button : {
4942 marginTop : theme . spacing ( 2 )
50- } ,
51- clickable_text : {
52- marginTop : theme . spacing ( 1 ) ,
53- textAlign : "center" ,
54- color : "#949494"
5543 }
5644} ) )
5745
@@ -139,20 +127,17 @@ const Login: FC<LoginProps> = (props) => {
139127 src = "https://lottie.host/919997f6-e82f-4995-b17d-bb3dad2376be/jDvgCK2W1q.lottie"
140128 autoplay
141129 />
142- < Card raised >
130+ < Card raised sx = { { borderRadius : '16px' } } >
143131 < CardContent >
144- < Grid container className = { classes . paper } >
145- < Avatar className = { classes . avatar } style = { { color : 'white' , backgroundColor : '#ba2e2e' } } >
146- < LockOutlinedIcon />
147- </ Avatar >
148- < Typography component = "h1" variant = "h5" >
149- Войти
150- </ Typography >
151- { loginState . error && (
152- < p style = { { color : "red" , marginBottom : "0" } } >
153- { loginState . error }
154- </ p >
155- ) }
132+ < Grid container direction = "column" spacing = { 1 } alignItems = { "center" } >
133+ < Grid item >
134+ < Typography component = "h1" variant = "h5" >
135+ Привет 👋, рады Вас видеть
136+ </ Typography >
137+ </ Grid >
138+ { loginState . error && loginState . error . length > 0 && < Grid item > < Alert severity = { "error" } >
139+ { loginState . error }
140+ </ Alert > </ Grid > }
156141 </ Grid >
157142 < form onSubmit = { ( e ) => handleSubmit ( e ) } className = { classes . form } >
158143 < Grid container direction = "column" justifyContent = "center" >
@@ -181,6 +166,11 @@ const Login: FC<LoginProps> = (props) => {
181166 value = { loginState . password }
182167 onChange = { handleChangePassword }
183168 />
169+ < Link to = "/recovery" state = { { email : loginState . email } } >
170+ < Typography variant = { "caption" } >
171+ Забыли пароль?
172+ </ Typography >
173+ </ Link >
184174 </ Grid >
185175 < Grid item className = { classes . button } >
186176 < Button
@@ -195,21 +185,18 @@ const Login: FC<LoginProps> = (props) => {
195185 </ Grid >
196186 </ Grid >
197187 </ form >
198- < Grid className = { classes . button } >
199- < Button
200- fullWidth
201- variant = "contained"
202- color = "primary"
203- onClick = { ( ) => window . location . assign ( "/register" ) }
204- >
205- Зарегистрироваться
206- </ Button >
207- </ Grid >
208- < Grid className = { classes . clickable_text } >
209- < Link to = "/recovery" state = { { email : loginState . email } } style = { { textDecoration : "underline" } } >
210- Забыли пароль?
188+ < Stack justifyContent = { "center" } direction = { "row" } alignItems = { "baseline" }
189+ style = { { paddingTop : 15 } }
190+ spacing = { 1 } >
191+ < Typography variant = { "body2" } >
192+ Впервые тут?
193+ </ Typography >
194+ < Link to = "/register" >
195+ < Typography variant = { "body2" } >
196+ Регистрация
197+ </ Typography >
211198 </ Link >
212- </ Grid >
199+ </ Stack >
213200 </ CardContent >
214201 </ Card >
215202 </ Container >
0 commit comments