30 lines
752 B
TypeScript
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}
|
|
/>
|
|
))}
|
|
</>
|
|
);
|
|
}
|