import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { useSelector } from 'react-redux'; import NftDefaultImage from '../../app/nft-default-image/nft-default-image'; import { AvatarNetwork, AvatarNetworkSize, BadgeWrapper, BadgeWrapperAnchorElementShape, Box, } from '../../component-library'; import { BackgroundColor, Display, JustifyContent, } from '../../../helpers/constants/design-system'; import { getIpfsGateway, getTestNetworkBackgroundColor, } from '../../../selectors'; export const NftItem = ({ alt, name, src, networkName, networkSrc, tokenId, onClick, clickable, nftImageURL, }) => { const testNetworkBackgroundColor = useSelector(getTestNetworkBackgroundColor); const isIpfsEnabled = useSelector(getIpfsGateway); const isIpfsURL = nftImageURL?.includes('ipfs:'); return ( } > {isIpfsEnabled ? ( ) : ( <> {isIpfsURL ? ( ) : ( )} )} ); }; NftItem.propTypes = { src: PropTypes.string, alt: PropTypes.string.isRequired, name: PropTypes.string.isRequired, networkName: PropTypes.string.isRequired, networkSrc: PropTypes.string.isRequired, tokenId: PropTypes.string.isRequired, onClick: PropTypes.func, clickable: PropTypes.bool, nftImageURL: PropTypes.string, };