-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Copy pathUsers.js
69 lines (60 loc) · 1.91 KB
/
Users.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
69
import React, { Component } from 'react';
import { Badge, Card, CardBody, CardHeader, Col, Row, Table } from 'reactstrap';
import usersData from './UsersData'
function UserRow(props) {
const user = props.user
const userLink = `#/users/${user.id}`
const getBadge = (status) => {
return status === 'Active' ? 'success' :
status === 'Inactive' ? 'secondary' :
status === 'Pending' ? 'warning' :
status === 'Banned' ? 'danger' :
'primary'
}
return (
<tr key={user.id.toString()}>
<th scope="row"><a href={userLink}>{user.id}</a></th>
<td><a href={userLink}>{user.name}</a></td>
<td>{user.registered}</td>
<td>{user.role}</td>
<td><Badge href={userLink} color={getBadge(user.status)}>{user.status}</Badge></td>
</tr>
)
}
class Users extends Component {
render() {
const userList = usersData.filter((user) => user.id < 10)
return (
<div className="animated fadeIn">
<Row>
<Col xl={6}>
<Card>
<CardHeader>
<i className="fa fa-align-justify"></i> Users <small className="text-muted">example</small>
</CardHeader>
<CardBody>
<Table responsive hover>
<thead>
<tr>
<th scope="col">id</th>
<th scope="col">name</th>
<th scope="col">registered</th>
<th scope="col">role</th>
<th scope="col">status</th>
</tr>
</thead>
<tbody>
{userList.map((user, index) =>
<UserRow key={index} user={user}/>
)}
</tbody>
</Table>
</CardBody>
</Card>
</Col>
</Row>
</div>
)
}
}
export default Users;