MessageTableHeader.js
2.52 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
79
80
81
82
import React from 'react';
import PropTypes from 'prop-types';
import {
UncontrolledButtonDropdown,
DropdownToggle,
DropdownMenu,
DropdownItem,
Input,
} from 'reactstrap';
import s from './MessageTableHeader.module.scss';
const MessageTableHeader = (props) => {
const { all, none, read, unread, markRead, markUnread, deleteItems, search } = props;
const select = [
{ id: 0, title: 'All', onClick: all },
{ id: 1, title: 'None', onClick: none },
{ id: 2 },
{ id: 3, title: 'Read', onClick: read },
{ id: 4, title: 'Unread', onClick: unread },
];
const action = [
{ id: 1, title: 'Reply' },
{ id: 2, title: 'Forward' },
{ id: 3, title: 'Archive' },
{ id: 4 },
{ id: 5, title: 'Mark As Read', onClick: markRead },
{ id: 6, title: 'Mark As Unread', onClick: markUnread },
{ id: 7 },
{ id: 8, title: 'Delete', onClick: deleteItems },
];
return (
<div className={s.messageTableHeader}>
<div>
<UncontrolledButtonDropdown size="sm">
<DropdownToggle
caret color="default"
className="dropdown-toggle-split mr-xs"
>
Select
</DropdownToggle>
<DropdownMenu>
{select.map(item =>
(Object.keys(item).length > 1
? <DropdownItem key={item.id} onClick={item.onClick}>{item.title}</DropdownItem>
: <DropdownItem key={item.id} divider />),
)}
</DropdownMenu>
</UncontrolledButtonDropdown >
<UncontrolledButtonDropdown size="sm">
<DropdownToggle
caret color="default"
className="dropdown-toggle-split mr-xs"
>
Actions
</DropdownToggle>
<DropdownMenu>
{action.map(item =>
(Object.keys(item).length > 1
? <DropdownItem key={item.id} onClick={item.onClick}>{item.title}</DropdownItem>
: <DropdownItem key={item.id} divider />),
)}
</DropdownMenu>
</UncontrolledButtonDropdown>
</div>
<Input placeholder="Search Messages" size="sm" onChange={e => search(e.target.value)} />
</div>
);
};
MessageTableHeader.propTypes = {
all: PropTypes.func.isRequired,
none: PropTypes.func.isRequired,
read: PropTypes.func.isRequired,
unread: PropTypes.func.isRequired,
markRead: PropTypes.func.isRequired,
markUnread: PropTypes.func.isRequired,
deleteItems: PropTypes.func.isRequired,
search: PropTypes.func.isRequired,
};
export default MessageTableHeader;