@@ -2,33 +2,53 @@ import React from "react";
2
2
import { connect } from "react-redux" ;
3
3
import { addTodo } from "../actions/add-todo" ;
4
4
import { changeInput } from "../actions/change-input" ;
5
- import { FormControl , InputLabel , Input , Button } from "@material-ui/core" ;
5
+ import { FormControl , Grid , Button , TextField } from "@material-ui/core" ;
6
6
7
7
const TodoInput = props => {
8
8
return (
9
9
< div >
10
10
< FormControl >
11
- < InputLabel > Add Todo</ InputLabel >
12
- < Input value = { props . input } onChange = { props . onChangeInput } />
11
+ { /* <Inputbel>Add Todo</InputLabel> */ }
12
+ < Grid
13
+ container
14
+ spacing = { 3 }
15
+ direction = "row"
16
+ justify = "center"
17
+ alignItems = "center"
18
+ >
19
+ < Grid item xs = { 8 } >
20
+ < TextField
21
+ variant = "outlined"
22
+ label = "Add ToDo"
23
+ margin = "normal"
24
+ value = { props . input }
25
+ onChange = { props . onChangeInput }
26
+ />
27
+ </ Grid >
28
+ < Grid item xs = { 4 } >
29
+ < Button
30
+ variant = "outlined"
31
+ color = "primary"
32
+ onClick = { ( ) => {
33
+ props . onAddTodo ( props . index + 1 , props . input ) ;
34
+ } }
35
+ >
36
+ Add to do
37
+ </ Button >
38
+ </ Grid >
39
+ </ Grid >
13
40
</ FormControl >
14
- < Button
15
- onClick = { ( ) => {
16
- props . onAddTodo ( props . index + 1 , props . input ) ;
17
- } }
18
- >
19
- Add to do
20
- </ Button >
21
41
</ div >
22
42
) ;
23
43
} ;
24
44
25
- const mapStatetoProps = state => {
45
+ const mapStateToProps = state => {
26
46
return {
27
47
input : state . input . input ,
28
48
index : state . todos . index
29
49
} ;
30
50
} ;
31
- const mapActionstoProps = dispatch => {
51
+ const mapActionsToProps = dispatch => {
32
52
return {
33
53
onAddTodo : ( id , text ) => {
34
54
dispatch ( addTodo ( { id, text } ) ) ;
@@ -39,6 +59,6 @@ const mapActionstoProps = dispatch => {
39
59
} ;
40
60
41
61
export default connect (
42
- mapStatetoProps ,
43
- mapActionstoProps
62
+ mapStateToProps ,
63
+ mapActionsToProps
44
64
) ( TodoInput ) ;
0 commit comments