-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.jsx
More file actions
66 lines (59 loc) · 1.83 KB
/
Copy pathindex.jsx
File metadata and controls
66 lines (59 loc) · 1.83 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
import React, { PropTypes } from 'react';
import { Table } from 'react-bootstrap';
import { Link } from 'react-router';
import './index.scss';
import cx from 'classnames';
const SortableTh = ({ children, active, asc, onClick }) => (
<th className={cx('sortabel')} onClick={onClick}>
<span>{children}</span>
{active && <span>{asc ? '(asc)' : '(dest)'}</span>}
</th>
);
const TaskTable = ({ tasks, projectId, toggleSort, sortField, sortDirection }) => (
<Table>
<thead>
<tr>
<th>Title</th>
<th>Status</th>
<SortableTh
active={sortField === 'assigneeName'}
asc={sortDirection === 'asc'}
onClick={() => toggleSort('assigneeName')}
>Assignee</SortableTh>
<th>Version</th>
<SortableTh
active={sortField === 'createAt'}
asc={sortDirection === 'asc'}
onClick={() => toggleSort('createAt')}
>createAt</SortableTh>
</tr>
</thead>
<tbody>
{tasks.map(task => (
<tr key={task.id}>
<td>
<Link to={`/projects/${projectId}/tasks/${task.id}`}>{task.title}</Link>
</td>
<td>
{task.status}
</td>
<td>
{task.assigneeName}
</td>
<td>
{task.version}
</td>
<td>
{task.createAt}
</td>
</tr>
))}
</tbody>
</Table>
);
TaskTable.propTypes = {
tasks: PropTypes.array,
projectId: PropTypes.string,
toggleSort: PropTypes.func,
};
export default TaskTable;