-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtable.tsx
More file actions
67 lines (61 loc) · 1.56 KB
/
Copy pathtable.tsx
File metadata and controls
67 lines (61 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { useContext } from 'react'
import BalanceRow from './row'
import Spinner from 'components/spinner'
import { ContractsContext } from 'components/providers/contracts'
import { ConfigContext } from 'components/providers/config'
import { getAssetBalance } from 'lib/marina'
import { WalletType } from 'lib/wallet'
type Props = {
wallet: WalletType
balances: Record<string, number>
}
const BalanceTable: React.FC<Props> = ({ wallet, balances }) => {
const { config } = useContext(ConfigContext)
const { loading } = useContext(ContractsContext)
const { assets } = config
if (loading) return <Spinner />
return (
<>
<h5>{wallet}</h5>
<table className="table is-fullwidth">
<thead>
<tr>
<th>Ticker</th>
<th>
<abbr title="Quantity" />
Qty
</th>
</tr>
</thead>
<tbody>
{assets &&
assets.map((asset, index) => (
<BalanceRow
key={index}
asset={asset}
amount={getAssetBalance(asset, balances)}
/>
))}
</tbody>
<style jsx>{`
table {
font-size: 0.9rem;
}
td:nth-child(2),
th:nth-child(2) {
text-align: right;
}
td:nth-child(2) {
color: #63159b;
}
img {
height: 20px;
position: relative;
top: 4px;
}
`}</style>
</table>
</>
)
}
export default BalanceTable