ghost-portal/packages/page-generic-asset/src/AssetRow.tsx
Keith Ingram 2081464de8
Rewrite & update to page-contracts (#2873)
* first commit

* finish

* InputMegaGas, use BN consts'

* update util'

* tags issue

* manifest

* import bn_zero

* rm

* restore contract tags

* fix tags onClose

* sec to ms

* ms -> sec

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-06-09 14:56:10 +02:00

43 lines
1.2 KiB
TypeScript

// Copyright 2019 @polkadot/app-generic-asset 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 React, { useState } from 'react';
import { CopyButton } from '@polkadot/react-components';
import Row, { RowProps } from '@polkadot/react-components/Row';
import { useTranslation } from './translate';
interface Props extends Omit<RowProps, 'onSaveName'> {
onSaveName: (name: string) => void;
assetId: string;
}
export default function AssetRow ({ assetId, buttons, children, className, defaultName = 'New Asset', isDisabled, isInline, onSaveName }: Props): React.ReactElement<Props> {
const { t } =
useTranslation();
const [name, setName] = useState(defaultName);
return (
<Row
buttons={buttons}
className={className}
details={
<div>
<CopyButton value={assetId}>
<span>{t('Asset ID')}: {assetId}</span>
</CopyButton>
</div>
}
isDisabled={isDisabled}
isEditableName
isInline={isInline}
name={name}
onChangeName={setName}
onSaveName={onSaveName}
>
{children}
</Row>
);
}