Component.tsx
1.9 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import * as React from "react";
import { Link } from "react-router-dom";
import TextField from "material-ui/TextField";
import RaisedButton from "material-ui/RaisedButton";
import DatePicker from "material-ui/DatePicker";
import Toggle from "material-ui/Toggle";
import MenuItem from "material-ui/MenuItem";
import DropDownMenu from "material-ui/DropDownMenu";
require("./styles.scss");
const style = {
width: "100%"
};
interface Props {
user: any;
createDataset(input: any): void;
}
interface State {
comment: string;
droneId: string;
}
class RequestPage extends React.Component<Props, State> {
state = {
comment: "",
droneId: ""
};
handleChangeComment = event => this.setState({ comment: event.target.value });
handleChangeDrone = (event, index, droneId) => this.setState({ droneId });
public render() {
const { props, state } = this;
const minDate = new Date();
const maxDate = new Date();
maxDate.setDate(maxDate.getDate() + 90);
const { createDataset } = props;
return (
<div className="dataset-page">
<h2>데이터셋 등록</h2>
<TextField
hintText="설명"
type="text"
value={state.comment}
onChange={this.handleChangeComment}
style={style}
/>
<h3>파일</h3>
<input type="file" />
<h3>촬영한 드론</h3>
<DropDownMenu
maxHeight={300}
value={state.droneId}
onChange={this.handleChangeDrone}
>
{props.user.drones.map(drone => (
<MenuItem
key={drone.id}
value={drone.id}
primaryText={`${drone.name} (${drone.model.name})`}
/>
))}
</DropDownMenu>
<RaisedButton
label="확인"
primary={true}
onClick={() => createDataset(state)}
/>
</div>
);
}
}
export default RequestPage;