mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
* Add ipfs gateway and collectible state to mock-state.json * Add collectible-default-image test with snapshot and testids * Add Collectible Details test, snapshot, and test-ids * Add Collectible Options tests and test-ids * Add Collectible Items test and test-ids. * Add more tests to Add Collectible component * Update Security Tab snapshot with ipfs gateway state value * Add data-testid to Menu component for menu background * Lint * Bump coverage targets * Remove commented import --------- Co-authored-by: David Walsh <davidwalsh83@gmail.com>
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classnames from 'classnames';
|
|
import Typography from '../../ui/typography';
|
|
import { TypographyVariant } from '../../../helpers/constants/design-system';
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
|
|
export default function CollectibleDefaultImage({
|
|
name,
|
|
tokenId,
|
|
handleImageClick,
|
|
}) {
|
|
const t = useI18nContext();
|
|
const Tag = handleImageClick ? 'button' : 'div';
|
|
return (
|
|
<Tag
|
|
tabIndex={0}
|
|
data-testid="collectible-default-image"
|
|
className={classnames('collectible-default', {
|
|
'collectible-default--clickable': handleImageClick,
|
|
})}
|
|
onClick={handleImageClick}
|
|
>
|
|
<Typography
|
|
variant={TypographyVariant.H6}
|
|
className="collectible-default__text"
|
|
>
|
|
{name ?? t('unknownCollection')} <br /> #{tokenId}
|
|
</Typography>
|
|
</Tag>
|
|
);
|
|
}
|
|
|
|
CollectibleDefaultImage.propTypes = {
|
|
/**
|
|
* The name of the collectible collection if not supplied will default to "Unnamed collection"
|
|
*/
|
|
name: PropTypes.string,
|
|
/**
|
|
* The token id of the collectible
|
|
*/
|
|
tokenId: PropTypes.string,
|
|
/**
|
|
* The click handler for the collectible default image
|
|
*/
|
|
handleImageClick: PropTypes.func,
|
|
};
|