ghost-portal/packages/page-council/src/Overview/Voters.tsx
Jaco a7fade8724
Jest config cleanup (#6053)
* Jest config cleanup

* auto-lint fixes
2021-09-01 21:38:45 +03:00

43 lines
1.1 KiB
TypeScript

// Copyright 2017-2021 @polkadot/app-democracy authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AccountId, Balance } from '@polkadot/types/interfaces';
import React from 'react';
import { AddressMini, Expander } from '@polkadot/react-components';
import { FormatBalance } from '@polkadot/react-query';
import { formatNumber } from '@polkadot/util';
interface Props {
balance?: Balance;
voters?: AccountId[];
}
function Voters ({ balance, voters }: Props): React.ReactElement<Props> {
if (!balance || !voters || !voters.length) {
return <><td className='all number' /><td className='number' /></>;
}
return (
<>
<td className='all expand'>
<Expander summary={<FormatBalance value={balance} />}>
{voters.map((who): React.ReactNode =>
<AddressMini
key={who.toString()}
value={who}
withLockedVote
/>
)}
</Expander>
</td>
<td className='number'>
{formatNumber(voters.length)}
</td>
</>
);
}
export default React.memo(Voters);