refactor: reduce styling boilerplate
This commit is contained in:
parent
4b5ca48190
commit
24a1ca84a6
1 changed files with 22 additions and 25 deletions
|
|
@ -15,21 +15,20 @@ import { H4, Label2, P, Info2 } from 'src/components/typography'
|
|||
import styles from './Assets.styles'
|
||||
const useStyles = makeStyles(styles)
|
||||
|
||||
const cellStyling = {
|
||||
borderBottom: '4px solid white',
|
||||
padding: 0,
|
||||
paddingLeft: 20,
|
||||
paddingRight: 20
|
||||
}
|
||||
|
||||
const Cell = withStyles({
|
||||
root: {
|
||||
borderBottom: '4px solid white',
|
||||
padding: 0,
|
||||
paddingLeft: 20,
|
||||
paddingRight: 20
|
||||
}
|
||||
root: cellStyling
|
||||
})(TableCell)
|
||||
|
||||
const HeaderCell = withStyles({
|
||||
root: {
|
||||
borderBottom: '4px solid white',
|
||||
padding: 0,
|
||||
paddingLeft: 20,
|
||||
paddingRight: 20,
|
||||
...cellStyling,
|
||||
backgroundColor: 'white'
|
||||
}
|
||||
})(TableCell)
|
||||
|
|
@ -64,22 +63,20 @@ const AssetsAmountTable = ({ title, data = [], numToRender }) => {
|
|||
</TableHead>
|
||||
<TableBody>
|
||||
{data?.map((asset, idx) => {
|
||||
if (idx < numToRender) {
|
||||
return (
|
||||
<TableRow className={classes.row} key={idx}>
|
||||
<Cell align="left">
|
||||
<P>{asset.display}</P>
|
||||
</Cell>
|
||||
<Cell align="right">
|
||||
<P>{`${selectAmountPrefix(asset)}
|
||||
if (!(idx < numToRender)) return <></>
|
||||
return (
|
||||
<TableRow className={classes.row} key={idx}>
|
||||
<Cell align="left">
|
||||
<P>{asset.display}</P>
|
||||
</Cell>
|
||||
<Cell align="right">
|
||||
<P>{`${selectAmountPrefix(asset)}
|
||||
${formatCurrency(Math.abs(asset.amount))} ${
|
||||
asset.currency
|
||||
}`}</P>
|
||||
</Cell>
|
||||
</TableRow>
|
||||
)
|
||||
}
|
||||
return null
|
||||
asset.currency
|
||||
}`}</P>
|
||||
</Cell>
|
||||
</TableRow>
|
||||
)
|
||||
})}
|
||||
<TableRow className={classes.totalRow} key={data?.length + 1}>
|
||||
<Cell align="left">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue