-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathNewTodo.js
More file actions
55 lines (47 loc) · 1.22 KB
/
NewTodo.js
File metadata and controls
55 lines (47 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React from "react";
import * as TodoActions from "../actions/TodoActions";
export default class NewTodo extends React.Component {
constructor(props) {
super();
this.state = {
newTodo: ""
};
}
addTodo(e) {
e.preventDefault();
TodoActions.createTodo(this.state.newTodo);
this.setState({newTodo: ""});
}
handleChange(e) {
this.setState({newTodo: e.target.value});
}
render() {
const inputStyling = {
borderRadius: "10px",
borderStyle: "solid",
borderWidth: "1px",
borderColor: "#B19FBA",
marginRight: "20px",
minWidth: "200px",
backgroundColor: "#D8CFDD",
padding: "3px 15px 3px 15px"
};
const formStyling = {
paddingBottom: "10px"
};
const standardButton = {
borderRadius: "10px",
borderStyle: "none",
padding: "3px 15px 3px 15px",
fontFamily: "Roboto",
backgroundColor: "#765786",
color: "#FFF"
};
return (
<form style={formStyling}>
<input style={inputStyling} type="text" value={this.state.newTodo} onChange={this.handleChange.bind(this)}/>
<button style={standardButton} onClick={this.addTodo.bind(this)}>Add New</button>
</form>
);
}
}