Buttony rows in table.

pull/20/head
Sander Vocke 5 years ago
parent b78f84ffd0
commit 72a5515167
  1. 40
      client/src/components/tables/ResultsTable.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { TableContainer, Table, TableHead, TableRow, TableCell, Paper, makeStyles, TableBody, Chip } from '@material-ui/core';
import { TableContainer, Table, TableHead, TableRow, TableCell, Paper, makeStyles, TableBody, Chip, Box, Button } from '@material-ui/core';
import stringifyList from '../../lib/stringifyList';
export interface SongGetters {
@ -39,16 +39,44 @@ export function SongTable(props: IProps) {
const artist = props.songGetters.getArtist(song);
const album = props.songGetters.getAlbum(song);
const tags = props.songGetters.getTags(song).map((tag: string[]) => {
return <Chip label={stringifyList(tag, undefined, (idx: number, e: string) => {
return <Box ml={0.5} mr={0.5}>
<Chip size="small" label={stringifyList(tag, undefined, (idx: number, e: string) => {
return (idx === 0) ? e : " / " + e;
})} />
</Box>
});
const TextCell = (props: any) => {
const classes = makeStyles({
button: {
textTransform: "none",
fontWeight: 400,
paddingLeft: '0',
}
})();
return <TableCell padding="none" {...props}>
<Button className={classes.button} fullWidth={true}>
<Box
width="100%"
display="flex"
alignItems="center"
paddingLeft="16px"
>
{props.children}
</Box>
</Button>
</TableCell>;
}
return <TableRow key={title}>
<TableCell align="left">{title}</TableCell>
<TableCell align="left">{artist}</TableCell>
<TableCell align="left">{album}</TableCell>
<TableCell align="left">{tags}</TableCell>
<TextCell align="left">{title}</TextCell>
<TextCell align="left">{artist}</TextCell>
<TextCell align="left">{album}</TextCell>
<TableCell padding="none" align="left" width="25%">
<Box display="flex" alignItems="center">
{tags}
</Box>
</TableCell>
</TableRow>
})}
</TableBody>

Loading…
Cancel
Save