refactor: reduce styling boilerplate

This commit is contained in:
José Oliveira 2021-07-06 15:22:15 +01:00
parent 4b5ca48190
commit 24a1ca84a6

View file

@ -15,21 +15,20 @@ import { H4, Label2, P, Info2 } from 'src/components/typography'
import styles from './Assets.styles'
const useStyles = makeStyles(styles)
const Cell = withStyles({
root: {
const cellStyling = {
borderBottom: '4px solid white',
padding: 0,
paddingLeft: 20,
paddingRight: 20
}
}
const Cell = withStyles({
root: cellStyling
})(TableCell)
const HeaderCell = withStyles({
root: {
borderBottom: '4px solid white',
padding: 0,
paddingLeft: 20,
paddingRight: 20,
...cellStyling,
backgroundColor: 'white'
}
})(TableCell)
@ -64,7 +63,7 @@ const AssetsAmountTable = ({ title, data = [], numToRender }) => {
</TableHead>
<TableBody>
{data?.map((asset, idx) => {
if (idx < numToRender) {
if (!(idx < numToRender)) return <></>
return (
<TableRow className={classes.row} key={idx}>
<Cell align="left">
@ -78,8 +77,6 @@ const AssetsAmountTable = ({ title, data = [], numToRender }) => {
</Cell>
</TableRow>
)
}
return null
})}
<TableRow className={classes.totalRow} key={data?.length + 1}>
<Cell align="left">