refactor: rename table cell component

This commit is contained in:
José Oliveira 2021-07-02 01:30:55 +01:00
parent a93f56cdc7
commit 4b5ca48190

View file

@ -15,7 +15,7 @@ import { H4, Label2, P, Info2 } from 'src/components/typography'
import styles from './Assets.styles' import styles from './Assets.styles'
const useStyles = makeStyles(styles) const useStyles = makeStyles(styles)
const StyledCell = withStyles({ const Cell = withStyles({
root: { root: {
borderBottom: '4px solid white', borderBottom: '4px solid white',
padding: 0, padding: 0,
@ -67,27 +67,27 @@ const AssetsAmountTable = ({ title, data = [], numToRender }) => {
if (idx < numToRender) { if (idx < numToRender) {
return ( return (
<TableRow className={classes.row} key={idx}> <TableRow className={classes.row} key={idx}>
<StyledCell align="left"> <Cell align="left">
<P>{asset.display}</P> <P>{asset.display}</P>
</StyledCell> </Cell>
<StyledCell align="right"> <Cell align="right">
<P>{`${selectAmountPrefix(asset)} <P>{`${selectAmountPrefix(asset)}
${formatCurrency(Math.abs(asset.amount))} ${ ${formatCurrency(Math.abs(asset.amount))} ${
asset.currency asset.currency
}`}</P> }`}</P>
</StyledCell> </Cell>
</TableRow> </TableRow>
) )
} }
return null return null
})} })}
<TableRow className={classes.totalRow} key={data?.length + 1}> <TableRow className={classes.totalRow} key={data?.length + 1}>
<StyledCell align="left"> <Cell align="left">
<Info2>{`Total ${R.toLower(title)}`}</Info2> <Info2>{`Total ${R.toLower(title)}`}</Info2>
</StyledCell> </Cell>
<StyledCell align="right"> <Cell align="right">
<Info2>{`${formatCurrency(totalAmount)} ${currency}`}</Info2> <Info2>{`${formatCurrency(totalAmount)} ${currency}`}</Info2>
</StyledCell> </Cell>
</TableRow> </TableRow>
</TableBody> </TableBody>
</Table> </Table>