2022-06-30 17:46:38 +02:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classnames from 'classnames';
|
|
|
|
import Typography from '../../ui/typography';
|
|
|
|
import { TYPOGRAPHY } from '../../../helpers/constants/design-system';
|
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
|
|
|
|
|
|
export default function CollectibleDefaultImage({
|
|
|
|
name,
|
|
|
|
tokenId,
|
|
|
|
handleImageClick,
|
|
|
|
}) {
|
|
|
|
const t = useI18nContext();
|
2023-01-18 23:39:15 +01:00
|
|
|
const Tag = handleImageClick ? 'button' : 'div';
|
2022-06-30 17:46:38 +02:00
|
|
|
return (
|
2023-01-18 23:39:15 +01:00
|
|
|
<Tag
|
|
|
|
tabIndex={0}
|
2022-06-30 17:46:38 +02:00
|
|
|
className={classnames('collectible-default', {
|
|
|
|
'collectible-default--clickable': handleImageClick,
|
|
|
|
})}
|
|
|
|
onClick={handleImageClick}
|
|
|
|
>
|
|
|
|
<Typography variant={TYPOGRAPHY.H6} className="collectible-default__text">
|
|
|
|
{name ?? t('unknownCollection')} <br /> #{tokenId}
|
|
|
|
</Typography>
|
2023-01-18 23:39:15 +01:00
|
|
|
</Tag>
|
2022-06-30 17:46:38 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
};
|