-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathPeopleTable.js
More file actions
36 lines (30 loc) · 795 Bytes
/
PeopleTable.js
File metadata and controls
36 lines (30 loc) · 795 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
import React, { PropTypes } from 'react'
const PeopleTable = ({peopleList}) =>
<div>
<table style={{marginBottom: '25px'}}>
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>E-mail</th>
</tr>
</thead>
<tbody>
{ peopleList.map((el, index) => <PeopleTableRow person={el} key={index} /> ) }
</tbody>
</table>
</div>
const PeopleTableRow = ({person: {firstName, lastName, email}}) =>
<tr>
<td>{firstName}</td>
<td>{lastName}</td>
<td>{email}</td>
</tr>
PeopleTableRow.propTypes = {
person: PropTypes.shape({
firstName: PropTypes.string.isRequired,
lastName: PropTypes.string.isRequired,
email: PropTypes.string.isRequired
}).isRequired
}
export default PeopleTable