Newer
Older
vkovtun
committed
import React from 'react'
import { withStyles } from '@material-ui/core/styles'
import Container from '@src/js/components/common/form/Container.jsx'
import FolderIcon from '@material-ui/icons/FolderOpen'
import FileIcon from '@material-ui/icons/DescriptionOutlined'
import autoBind from 'auto-bind'
width: '100%',
fontFamily: theme.typography.fontFamily,
},
tableHeader: {
textAlign: 'left'
},
nameColumn: {
textAlign: 'left'
},
sizeColumn: {
width: '11rem',
textAlign: 'left'
},
modifiedColumn: {
width: '11rem',
textAlign: 'right'
},
icon: {
verticalAlign: 'middle'
},
text: {
fontSize: theme.typography.body2.fontSize,
lineHeight: theme.typography.body2.fontSize
},
listContainer: {
flex: '1 1 100%'
},
tableRow: {
fontSize: theme.typography.body1.fontSize,
height: '2em'
},
tableData: {
padding: theme.spacing(2),
constructor(props, context) {
super(props, context)
autoBind(this)
}
getIcon(file) {
render() {
const { classes, files } = this.props
/* Create strings in messages. */
return (
<Container>
<table className={classes.content}>
<thead>
<th className={`${classes.tableData} ${classes.tableHeader}`}>Name</th>
<th className={`${classes.tableData} ${classes.tableHeader}`}>Size</th>
<th className={`${classes.tableData} ${classes.modifiedColumn} ${classes.tableHeader}`}>Modified</th>
</tr>
</thead>
<tbody>
{files.map((file, index) =>
<tr key={index} className={classes.tableRow}>
<td className={`${classes.tableData} ${classes.nameColumn}`}>{<>{this.getIcon(file)} {file.name}</>}</td>
<td className={`${classes.tableData} ${classes.sizeColumn}`}>{file.folder ? '-' : file.size}</td>
<td className={`${classes.tableData} ${classes.modifiedColumn}`}>{file.lastModifiedTime.toLocaleString()}</td>
</tr>
)}
</tbody>
</table>
</Container>
)
}