ghost-portal/packages/page-staking/src/Overview/Address/StakeOther.tsx
Jaco Greeff 5126dbff93
Rework table layouts (#2472)
* Rework table layouts

* Additional

* Additional

* Accounts & Contacts

* Cleanup alignment

* Mini links

* Ordering adjustments

* Empty indicators
2020-03-28 21:01:47 +01:00

44 lines
1.2 KiB
TypeScript

// Copyright 2017-2020 @polkadot/app-staking authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Balance } from '@polkadot/types/interfaces';
import BN from 'bn.js';
import React from 'react';
import { AddressMini, Expander } from '@polkadot/react-components';
import { FormatBalance } from '@polkadot/react-query';
import { formatNumber } from '@polkadot/util';
interface Props {
stakeOther?: BN;
nominators: [string, Balance][];
}
function StakeOther ({ nominators, stakeOther }: Props): React.ReactElement<Props> {
return (
<td className='number all'>
{stakeOther?.gtn(0) && (
<>
<Expander summary={
<FormatBalance value={stakeOther}>
&nbsp;({formatNumber(nominators.length)})
</FormatBalance>
}>
{nominators.map(([who, bonded]): React.ReactNode =>
<AddressMini
bonded={bonded}
key={who}
value={who}
withBonded
/>
)}
</Expander>
</>
)}
</td>
);
}
export default React.memo(StakeOther);