-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.jsx
More file actions
65 lines (56 loc) · 1.63 KB
/
Copy pathindex.jsx
File metadata and controls
65 lines (56 loc) · 1.63 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
import React from 'react';
import { Button, Label, ListGroupItem, ListGroup, Modal, Input } from 'react-bootstrap';
import { Link } from 'react-router';
import Select from 'react-select';
import 'react-select/dist/react-select.css';
const LinkedStateMixin = require('react-addons-linked-state-mixin');
const AddProjectModal = React.createClass({
mixins: [LinkedStateMixin],
getInitialState() {
return {
title: '',
userIds: [],
};
},
onChange(value) {
this.setState({
userIds: value,
});
},
render() {
const {
users,
addProject,
} = this.props;
const allUsers = users.map(user => (
{ value: user.id, label: user.name })
);
const create = () => {
const {
userIds,
title,
} = this.state;
const ids = userIds.map(id => parseInt(id, 10));
addProject(title, ids);
};
return (
<Modal {...this.props} >
<Modal.Body>
<Input valueLink={this.linkState('title')} type='text' label='project title' />
<b>Team:</b>
<Select
searchable={true}
multi={true}
value={this.state.userIds}
onChange={this.onChange}
options={allUsers}
/>
</Modal.Body>
<Modal.Footer>
<Button onClick={create}>create</Button>
</Modal.Footer>
</Modal>
);
},
});
export default AddProjectModal;