Skip to content

Commit e35b29c

Browse files
committed
screwing around with styling
1 parent c6ad203 commit e35b29c

File tree

2 files changed

+40
-20
lines changed

2 files changed

+40
-20
lines changed

src/App.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React from "react";
2-
import TodoInput from './components/ToDoInput'
3-
2+
import TodoInput from "./components/ToDoInput";
3+
import { Container } from "@material-ui/core";
44

55
function App() {
66
return (
7-
<div>
8-
<h1>Hello</h1>
7+
<Container maxWidth="md" >
8+
<h1>React-Redux To Do List with Material-UI</h1>
99
<TodoInput />
10-
</div>
10+
</Container>
1111
);
1212
}
1313

14-
export default App
14+
export default App;

src/components/ToDoInput.js

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,53 @@ import React from "react";
22
import { connect } from "react-redux";
33
import { addTodo } from "../actions/add-todo";
44
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";
66

77
const TodoInput = props => {
88
return (
99
<div>
1010
<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>
1340
</FormControl>
14-
<Button
15-
onClick={() => {
16-
props.onAddTodo(props.index + 1, props.input);
17-
}}
18-
>
19-
Add to do
20-
</Button>
2141
</div>
2242
);
2343
};
2444

25-
const mapStatetoProps = state => {
45+
const mapStateToProps = state => {
2646
return {
2747
input: state.input.input,
2848
index: state.todos.index
2949
};
3050
};
31-
const mapActionstoProps = dispatch => {
51+
const mapActionsToProps = dispatch => {
3252
return {
3353
onAddTodo: (id, text) => {
3454
dispatch(addTodo({ id, text }));
@@ -39,6 +59,6 @@ const mapActionstoProps = dispatch => {
3959
};
4060

4161
export default connect(
42-
mapStatetoProps,
43-
mapActionstoProps
62+
mapStateToProps,
63+
mapActionsToProps
4464
)(TodoInput);

0 commit comments

Comments
 (0)