forked from irinazheltisheva/fastsite-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntityTable.js
More file actions
45 lines (43 loc) · 997 Bytes
/
EntityTable.js
File metadata and controls
45 lines (43 loc) · 997 Bytes
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
import React from 'react'
const EntityTable = props => (
<table>
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{props.entities.length > 0 ? (
props.entities.map(entity => (
<tr key={entity.id}>
<td>{entity.id}</td>
<td>{entity.title}</td>
<td>
<button
onClick={() => {
props.editRow(entity)
}}
className="button muted-button"
>
Edit
</button>
<button
onClick={() => props.deleteEntity(entity.id)}
className="button muted-button"
>
Delete
</button>
</td>
</tr>
))
) : (
<tr>
<td colSpan={3}>No entities</td>
</tr>
)}
</tbody>
</table>
)
export default EntityTable