// 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, { useCallback } from 'react'; import { Card, Button } from '@polkadot/react-components'; import AssetRow from './AssetRow'; import { useTranslation } from './translate'; interface Props { assetId: string; className?: string; name: string; onSaveName: (id: string, name: string) => void; onForget: (id: string) => void; } function AssetCard ({ assetId, className, name, onForget, onSaveName }: Props): React.ReactElement { const { t } = useTranslation(); const _onForget = useCallback( (): void => onForget(assetId), [assetId, onForget] ); const _onSaveName = useCallback( (name: string): void => onSaveName(assetId, name), [assetId, onSaveName] ); return (
)} defaultName={name} isEditable onSaveName={_onSaveName} />
); } export default React.memo(AssetCard);