1
- import React from 'react' ;
1
+ import React , { Component } from 'react' ;
2
+ import { connect } from 'react' ;
3
+ import { LoginInt } from '../../interfaces/Interfaces' ;
4
+ import { setUsername , setPassword } from '../../actions/actionCreators' ;
5
+ import { useSelector } from 'react-redux' ;
6
+
2
7
import Avatar from '@material-ui/core/Avatar' ;
3
8
import Button from '@material-ui/core/Button' ;
4
9
import CssBaseline from '@material-ui/core/CssBaseline' ;
@@ -10,15 +15,31 @@ import Grid from '@material-ui/core/Grid';
10
15
import Box from '@material-ui/core/Box' ;
11
16
import LockOutlinedIcon from '@material-ui/icons/LockOutlined' ;
12
17
import Typography from '@material-ui/core/Typography' ;
13
- import { makeStyles } from '@material-ui/core/styles' ;
18
+ import { makeStyles , withStyles } from '@material-ui/core/styles' ;
14
19
import Container from '@material-ui/core/Container' ;
20
+ import { render } from 'enzyme' ;
21
+
22
+ const mapStateToProps = ( store : any ) => ( {
23
+ username : store . credentials . username ,
24
+ password : store . credentials . password
25
+ } )
26
+
27
+ const mapDispatchToProps = ( dispatch : any ) => ( {
28
+ setUsername : ( username : string ) => dispatch ( setUsername ( username ) ) ,
29
+ setPassword : ( password : string ) => dispatch ( setPassword ( password ) )
30
+ } )
31
+
32
+ interface LoginProps extends LoginInt {
33
+ setUsername ( username : string ) : void ,
34
+ setPassword ( username : string ) : void
35
+ }
15
36
16
37
function Copyright ( ) {
17
38
return (
18
39
< Typography variant = "body2" color = "textSecondary" align = "center" >
19
40
{ 'Copyright © ' }
20
41
< Link color = "inherit" href = "https://material-ui.com/" >
21
- Your Website
42
+ ReacType
22
43
</ Link > { ' ' }
23
44
{ new Date ( ) . getFullYear ( ) }
24
45
{ '.' }
@@ -46,8 +67,9 @@ const useStyles = makeStyles((theme) => ({
46
67
} ,
47
68
} ) ) ;
48
69
49
- export default function SignIn ( ) {
70
+ const SignIn : React . FC < LoginProps > = ( props ) => {
50
71
const classes = useStyles ( ) ;
72
+ const count = useSelector ( state => state ) ;
51
73
52
74
return (
53
75
< Container component = "main" maxWidth = "xs" >
@@ -114,4 +136,6 @@ export default function SignIn() {
114
136
</ Box >
115
137
</ Container >
116
138
) ;
117
- }
139
+ }
140
+
141
+ export default SignIn ;
0 commit comments