ghost-keychain/packages/extension-ui/src/Popup/Accounts/AccountsTree.tsx
2020-09-17 16:12:32 +02:00

30 lines
752 B
TypeScript

// Copyright 2019-2020 @polkadot/extension authors & contributors
// SPDX-License-Identifier: Apache-2.0
import React from 'react';
import { AccountWithChildren } from '@polkadot/extension-base/background/types';
import Account from './Account';
interface Props extends AccountWithChildren {
parentName?: string;
}
export default function AccountsTree ({ parentName, suri, ...account }: Props): React.ReactElement<Props> {
return (
<>
<Account
{...account}
parentName={parentName}
suri={suri}
/>
{account?.children?.map((child, index) => (
<AccountsTree
key={`${index}:${child.address}`}
{...child}
parentName={account.name}
/>
))}
</>
);
}