forked from cybersecurity-team/TorBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaterialinfo.js
More file actions
63 lines (57 loc) · 1.96 KB
/
Copy pathmaterialinfo.js
File metadata and controls
63 lines (57 loc) · 1.96 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
import React from 'react';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableRow from '@material-ui/core/TableRow';
import TableHead from '@material-ui/core/TableHead';
import TableCell from '@material-ui/core/TableCell';
import Paper from '@material-ui/core/Paper';
import MaterialHome from './materialhome';
import Button from '@material-ui/core/Button';
let id = 0;
function createRow(header, value) {
id += 1;
return {id, header, value};
}
class MaterialInfo extends React.Component {
constructor(props) {
super(props);
this.state = {rows: [], home: false};
for (const header in props.info) {
this.state.rows.push(createRow(header, props.info[header]));
}
this.onHome = this.onHome.bind(this);
}
onHome() {
this.setState({home: true});
}
render() {
if (this.state.home) return <MaterialHome/>;
return (
<form>
<Paper>
<Table>
<TableHead>
<TableRow>
<TableCell>Header</TableCell>
<TableCell>Value</TableCell>
</TableRow>
</TableHead>
<TableBody>
{this.state.rows.map(row => (
<TableRow key={row.id}>
<TableCell>{row.header}</TableCell>
<TableCell>{row.value}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</Paper>
<br/>
<Button onClick={this.onHome} variant="contained" color="primary">
HOME
</Button>
</form>
);
}
}
export default MaterialInfo;