-
Notifications
You must be signed in to change notification settings - Fork 1
/
Posts.js
68 lines (64 loc) · 1.58 KB
/
Posts.js
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
import React from 'react';
import Table, { IconColumn } from 'react-css-grid-table';
export default function(props) {
const headers = [
{
'value': 'check',
'width': '0.3fr',
},
{ 'label': 'Title', 'value': 'title', 'width': '2fr' },
{ 'label': 'Published Date', 'value': 'publishedDate', 'width': '1fr' },
{ 'label': 'Published By', 'value': 'publishedBy', 'width': '1fr' },
{ 'label': 'Last Modified', 'value': 'lastModified', 'width': '1fr' },
{
'value': 'comments',
'width': '0.5fr',
},
{
'value': 'hearts',
'width': '0.5fr',
},
];
const data = [
{
id: 1,
title: 'Carrot cake with a twist',
publishedDate: 'Feb 10, 2017,',
publishedBy: 'Rebecca Park',
lastModified: '22 seconds ago',
comments: 22,
hearts: 10
},
{
id: 2,
title: 'Green tea rice cake',
publishedDate: 'Nov 27, 2017',
publishedBy: 'Mumu Eaton',
lastModified: '1 day ago',
comments: 13,
hearts: 11
},
];
const customColumns = {
check: {
format: (data) => <IconColumn icon="icon ion-md-checkmark" data={data} />,
className: 'justify-content-center'
},
comments: {
body: (data) => <IconColumn icon="icon ion-ios-chatbubbles-outline" data={data} />
},
ghearts: {
body: (data) => <IconColumn icon="icon ion-ios-heart-outline" data={data} />
}
};
return (
<div className="Posts">
<h1>Posts</h1>
<Table
headers={headers}
data={data}
customColumns={customColumns}
/>
</div>
)
}