1
1
import React , { FormEvent , ReactElement , useState } from 'react' ;
2
- import { Button , Form , Container , Row , Col , Spinner , Image } from "react-bootstrap" ;
2
+ import { Button , Col , Container , Form , Image , Row , Spinner } from "react-bootstrap" ;
3
3
import { loginWithUsernameAndPassword } from "../../background/api/auth" ;
4
4
5
5
import logo from "../../assets/images/logos/logoWithWhiteBorder.png" ;
@@ -9,13 +9,13 @@ function Login(): ReactElement {
9
9
const [ password , setPassword ] = useState < string > ( "" ) ;
10
10
const [ stayLoggedIn , setStayLoggedIn ] = useState < boolean > ( true ) ;
11
11
const [ errorMessage , setErrorMessage ] = useState < string > ( "" ) ;
12
- const [ loading , setLoading ] = useState < boolean > ( false ) ;
12
+ const [ loading , setLoading ] = useState < boolean > ( false ) ;
13
13
14
14
15
15
const handleSubmit = ( event : FormEvent ) => {
16
16
event . preventDefault ( ) ;
17
17
setLoading ( true )
18
- loginWithUsernameAndPassword ( userName , password , stayLoggedIn )
18
+ loginWithUsernameAndPassword ( userName , password , stayLoggedIn )
19
19
. then ( ( ) => {
20
20
//nothing to do here :)
21
21
setErrorMessage ( "" ) ;
@@ -32,55 +32,58 @@ function Login(): ReactElement {
32
32
33
33
34
34
return (
35
- < Container className = "h-100" >
36
- < Container fluid className = "login-container" >
35
+ < Container fluid className = "h-100 ml-0 mr-0 login-page" >
36
+ < Container fluid className = "login-container bg-body-bg" >
37
+ < Container >
38
+ < Row className = "justify-content-md-center" >
39
+ < Image rounded src = { logo } height = "200px" width = "auto" />
40
+ </ Row >
41
+ < Row className = "justify-content-md-center" >
42
+ < h1 > Greetings Traveller!</ h1 >
43
+ </ Row >
44
+ < Row className = "justify-content-md-center" >
45
+ < h2 > Be welcome at FileFighter</ h2 >
46
+ </ Row >
47
+ </ Container >
48
+ < Container className = "login-input" >
49
+ < Row className = "mt-4" >
50
+ < Col >
51
+ < Form onSubmit = { handleSubmit } >
52
+ < Form . Group controlId = "formBasicUsername" >
53
+ < Form . Control placeholder = "Username" value = { userName }
54
+ onChange = { event => setUsername ( event . target . value ) } />
55
+ </ Form . Group >
37
56
38
- < Container >
39
- < Row className = "justify-content-md-center" >
40
- < Image rounded src = { logo } height = "200px" width = "auto" />
41
- </ Row >
42
- < Row className = "justify-content-md-center" >
43
- < h1 > Greetings Traveller!</ h1 >
44
- </ Row >
45
- < Row className = "justify-content-md-center" >
46
- < h2 > Be welcome at FileFighter</ h2 >
47
- </ Row >
48
- </ Container >
49
-
50
- < Row className = "mt-4" >
51
- < Col >
52
- < Form onSubmit = { handleSubmit } >
53
- < Form . Group controlId = "formBasicUsername" >
54
- < Form . Control placeholder = "Username" value = { userName } onChange = { event => setUsername ( event . target . value ) } />
55
- </ Form . Group >
56
-
57
- < Form . Group controlId = "formBasicPassword" >
58
- < Form . Control type = "password" placeholder = "Password" value = { password } onChange = { event => setPassword ( event . target . value ) } />
59
- < Form . Text className = "text-muted" >
60
- Contact your administrator if you have forgotten your login details.
61
- </ Form . Text >
62
- </ Form . Group >
57
+ < Form . Group controlId = "formBasicPassword" >
58
+ < Form . Control type = "password" placeholder = "Password" value = { password }
59
+ onChange = { event => setPassword ( event . target . value ) } />
60
+ < Form . Text className = "text-muted" >
61
+ Contact your administrator if you have forgotten your login details.
62
+ </ Form . Text >
63
+ </ Form . Group >
63
64
64
- < Button variant = "primary" type = "submit" block >
65
- < Spinner
66
- as = "span"
67
- animation = "grow"
68
- size = "sm"
69
- role = "status"
70
- aria-hidden = "true"
71
- className = { loading ? "" :"d-none" }
72
- /> < span className = { loading ? "sr-only" :"d-none" } > Loading...</ span > Sign in
73
- </ Button >
74
- < Form . Group controlId = "formBasicCheckbox" className = "mt-3 justify-content-center" >
75
- < Form . Check checked = { stayLoggedIn } type = "checkbox" label = "Keep me signed in*" onChange = { ( ) => setStayLoggedIn ( ! stayLoggedIn ) } />
76
- < Form . Text className = "text-muted" >
77
- *By clicking this, you accept the usage of cookies.
78
- </ Form . Text >
79
- </ Form . Group >
80
- < p className = "text-danger" > { errorMessage } </ p >
81
- </ Form >
82
- </ Col >
83
- </ Row >
65
+ < Button variant = "primary" type = "submit" block >
66
+ < Spinner
67
+ as = "span"
68
+ animation = "grow"
69
+ size = "sm"
70
+ role = "status"
71
+ aria-hidden = "true"
72
+ className = { loading ? "" : "d-none" }
73
+ /> < span className = { loading ? "sr-only" : "d-none" } > Loading...</ span > Sign in
74
+ </ Button >
75
+ < Form . Group controlId = "formBasicCheckbox" className = "mt-3 justify-content-center" >
76
+ < Form . Check checked = { stayLoggedIn } type = "checkbox" label = "Keep me signed in*"
77
+ onChange = { ( ) => setStayLoggedIn ( ! stayLoggedIn ) } />
78
+ < Form . Text className = "text-muted" >
79
+ *By clicking this, you accept the usage of cookies.
80
+ </ Form . Text >
81
+ </ Form . Group >
82
+ < p className = "text-danger" > { errorMessage } </ p >
83
+ </ Form >
84
+ </ Col >
85
+ </ Row >
86
+ </ Container >
84
87
</ Container >
85
88
</ Container > ) ;
86
89
}
0 commit comments