mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-10-31 22:09:48 +00:00
40 lines
988 B
TypeScript
40 lines
988 B
TypeScript
// Copyright 2017-2026 @pezkuwi/react-components authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { AccountId, AccountIndex, Address } from '@pezkuwi/types/interfaces';
|
|
import type { BN } from '@pezkuwi/util';
|
|
|
|
import React from 'react';
|
|
|
|
import { Bonded } from '@pezkuwi/react-query';
|
|
|
|
import { renderProvided } from './Balance.js';
|
|
|
|
export interface Props {
|
|
bonded?: BN | BN[];
|
|
className?: string;
|
|
label?: React.ReactNode;
|
|
params?: AccountId | AccountIndex | Address | string | Uint8Array | null;
|
|
withLabel?: boolean;
|
|
}
|
|
|
|
function BondedDisplay (props: Props): React.ReactElement<Props> | null {
|
|
const { bonded, className = '', label, params } = props;
|
|
|
|
if (!params) {
|
|
return null;
|
|
}
|
|
|
|
return bonded
|
|
? <>{renderProvided({ className, label, value: bonded })}</>
|
|
: (
|
|
<Bonded
|
|
className={`${className} ui--Bonded`}
|
|
label={label}
|
|
params={params}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export default React.memo(BondedDisplay);
|