2022-06-30 17:46:38 +02:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classnames from 'classnames';
|
Multichain NFT network badges (#19029)
* adding badges for nfts
* fixing default nft styling issue
* adding multichain flag, making borderRadius inline
* Apply suggestions from code review
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fixing imports
* removing nullcheck for guaranteed fields
* moving badgewrapper UI into multichain component
* using Box for button, removing inline style, border-radius for NFT default image
* adding nft badges to NFT Details page
* nits, snap update
* fixing/refactoring nftdefaultimage display, adding clickable, removing handleimageclick, refactor NFTItem, required props
* editing nft-default-image story, test, and snap
* Updating to fix positioning, use Box props to reduce CSS and BEM naming conventions
* moving minor styling to Box props, adding comment
* display block typo
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-06-02 17:01:51 +02:00
|
|
|
import {
|
|
|
|
Display,
|
|
|
|
AlignItems,
|
|
|
|
BlockSize,
|
|
|
|
JustifyContent,
|
|
|
|
TextVariant,
|
|
|
|
BorderRadius,
|
|
|
|
TextAlign,
|
|
|
|
BackgroundColor,
|
|
|
|
} from '../../../helpers/constants/design-system';
|
2022-06-30 17:46:38 +02:00
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
2023-07-20 00:32:35 +02:00
|
|
|
import { Text } from '../../component-library';
|
Multichain NFT network badges (#19029)
* adding badges for nfts
* fixing default nft styling issue
* adding multichain flag, making borderRadius inline
* Apply suggestions from code review
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fixing imports
* removing nullcheck for guaranteed fields
* moving badgewrapper UI into multichain component
* using Box for button, removing inline style, border-radius for NFT default image
* adding nft badges to NFT Details page
* nits, snap update
* fixing/refactoring nftdefaultimage display, adding clickable, removing handleimageclick, refactor NFTItem, required props
* editing nft-default-image story, test, and snap
* Updating to fix positioning, use Box props to reduce CSS and BEM naming conventions
* moving minor styling to Box props, adding comment
* display block typo
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-06-02 17:01:51 +02:00
|
|
|
import Box from '../../ui/box/box';
|
2022-06-30 17:46:38 +02:00
|
|
|
|
2023-06-15 22:18:12 +02:00
|
|
|
export default function NftDefaultImage({
|
|
|
|
name,
|
|
|
|
tokenId,
|
|
|
|
className,
|
|
|
|
clickable = false,
|
|
|
|
}) {
|
2022-06-30 17:46:38 +02:00
|
|
|
const t = useI18nContext();
|
|
|
|
return (
|
Multichain NFT network badges (#19029)
* adding badges for nfts
* fixing default nft styling issue
* adding multichain flag, making borderRadius inline
* Apply suggestions from code review
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fixing imports
* removing nullcheck for guaranteed fields
* moving badgewrapper UI into multichain component
* using Box for button, removing inline style, border-radius for NFT default image
* adding nft badges to NFT Details page
* nits, snap update
* fixing/refactoring nftdefaultimage display, adding clickable, removing handleimageclick, refactor NFTItem, required props
* editing nft-default-image story, test, and snap
* Updating to fix positioning, use Box props to reduce CSS and BEM naming conventions
* moving minor styling to Box props, adding comment
* display block typo
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-06-02 17:01:51 +02:00
|
|
|
<Box
|
2023-01-18 23:39:15 +01:00
|
|
|
tabIndex={0}
|
2023-02-16 20:23:29 +01:00
|
|
|
data-testid="nft-default-image"
|
2023-06-15 22:18:12 +02:00
|
|
|
className={classnames(className, 'nft-default', {
|
Multichain NFT network badges (#19029)
* adding badges for nfts
* fixing default nft styling issue
* adding multichain flag, making borderRadius inline
* Apply suggestions from code review
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fixing imports
* removing nullcheck for guaranteed fields
* moving badgewrapper UI into multichain component
* using Box for button, removing inline style, border-radius for NFT default image
* adding nft badges to NFT Details page
* nits, snap update
* fixing/refactoring nftdefaultimage display, adding clickable, removing handleimageclick, refactor NFTItem, required props
* editing nft-default-image story, test, and snap
* Updating to fix positioning, use Box props to reduce CSS and BEM naming conventions
* moving minor styling to Box props, adding comment
* display block typo
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-06-02 17:01:51 +02:00
|
|
|
'nft-default--clickable': clickable,
|
2022-06-30 17:46:38 +02:00
|
|
|
})}
|
Multichain NFT network badges (#19029)
* adding badges for nfts
* fixing default nft styling issue
* adding multichain flag, making borderRadius inline
* Apply suggestions from code review
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fixing imports
* removing nullcheck for guaranteed fields
* moving badgewrapper UI into multichain component
* using Box for button, removing inline style, border-radius for NFT default image
* adding nft badges to NFT Details page
* nits, snap update
* fixing/refactoring nftdefaultimage display, adding clickable, removing handleimageclick, refactor NFTItem, required props
* editing nft-default-image story, test, and snap
* Updating to fix positioning, use Box props to reduce CSS and BEM naming conventions
* moving minor styling to Box props, adding comment
* display block typo
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-06-02 17:01:51 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
alignItems={AlignItems.Center}
|
|
|
|
justifyContent={JustifyContent.Center}
|
|
|
|
backgroundColor={BackgroundColor.backgroundAlternative}
|
|
|
|
width={BlockSize.Full}
|
|
|
|
borderRadius={BorderRadius.LG}
|
2022-06-30 17:46:38 +02:00
|
|
|
>
|
Multichain NFT network badges (#19029)
* adding badges for nfts
* fixing default nft styling issue
* adding multichain flag, making borderRadius inline
* Apply suggestions from code review
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fixing imports
* removing nullcheck for guaranteed fields
* moving badgewrapper UI into multichain component
* using Box for button, removing inline style, border-radius for NFT default image
* adding nft badges to NFT Details page
* nits, snap update
* fixing/refactoring nftdefaultimage display, adding clickable, removing handleimageclick, refactor NFTItem, required props
* editing nft-default-image story, test, and snap
* Updating to fix positioning, use Box props to reduce CSS and BEM naming conventions
* moving minor styling to Box props, adding comment
* display block typo
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-06-02 17:01:51 +02:00
|
|
|
<Text
|
|
|
|
variant={TextVariant.bodySm}
|
|
|
|
textAlign={TextAlign.Center}
|
|
|
|
ellipsis
|
|
|
|
as="h6"
|
|
|
|
className="nft-default__text"
|
|
|
|
>
|
2022-06-30 17:46:38 +02:00
|
|
|
{name ?? t('unknownCollection')} <br /> #{tokenId}
|
2023-05-02 02:35:44 +02:00
|
|
|
</Text>
|
Multichain NFT network badges (#19029)
* adding badges for nfts
* fixing default nft styling issue
* adding multichain flag, making borderRadius inline
* Apply suggestions from code review
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fixing imports
* removing nullcheck for guaranteed fields
* moving badgewrapper UI into multichain component
* using Box for button, removing inline style, border-radius for NFT default image
* adding nft badges to NFT Details page
* nits, snap update
* fixing/refactoring nftdefaultimage display, adding clickable, removing handleimageclick, refactor NFTItem, required props
* editing nft-default-image story, test, and snap
* Updating to fix positioning, use Box props to reduce CSS and BEM naming conventions
* moving minor styling to Box props, adding comment
* display block typo
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-06-02 17:01:51 +02:00
|
|
|
</Box>
|
2022-06-30 17:46:38 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-02-16 20:23:29 +01:00
|
|
|
NftDefaultImage.propTypes = {
|
2022-06-30 17:46:38 +02:00
|
|
|
/**
|
2023-02-16 20:23:29 +01:00
|
|
|
* The name of the NFT collection if not supplied will default to "Unnamed collection"
|
2022-06-30 17:46:38 +02:00
|
|
|
*/
|
|
|
|
name: PropTypes.string,
|
|
|
|
/**
|
2023-02-16 20:23:29 +01:00
|
|
|
* The token id of the nft
|
2022-06-30 17:46:38 +02:00
|
|
|
*/
|
|
|
|
tokenId: PropTypes.string,
|
|
|
|
/**
|
Multichain NFT network badges (#19029)
* adding badges for nfts
* fixing default nft styling issue
* adding multichain flag, making borderRadius inline
* Apply suggestions from code review
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fixing imports
* removing nullcheck for guaranteed fields
* moving badgewrapper UI into multichain component
* using Box for button, removing inline style, border-radius for NFT default image
* adding nft badges to NFT Details page
* nits, snap update
* fixing/refactoring nftdefaultimage display, adding clickable, removing handleimageclick, refactor NFTItem, required props
* editing nft-default-image story, test, and snap
* Updating to fix positioning, use Box props to reduce CSS and BEM naming conventions
* moving minor styling to Box props, adding comment
* display block typo
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-06-02 17:01:51 +02:00
|
|
|
* Controls the css class for the cursor hover
|
2022-06-30 17:46:38 +02:00
|
|
|
*/
|
Multichain NFT network badges (#19029)
* adding badges for nfts
* fixing default nft styling issue
* adding multichain flag, making borderRadius inline
* Apply suggestions from code review
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fixing imports
* removing nullcheck for guaranteed fields
* moving badgewrapper UI into multichain component
* using Box for button, removing inline style, border-radius for NFT default image
* adding nft badges to NFT Details page
* nits, snap update
* fixing/refactoring nftdefaultimage display, adding clickable, removing handleimageclick, refactor NFTItem, required props
* editing nft-default-image story, test, and snap
* Updating to fix positioning, use Box props to reduce CSS and BEM naming conventions
* moving minor styling to Box props, adding comment
* display block typo
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-06-02 17:01:51 +02:00
|
|
|
clickable: PropTypes.bool,
|
2023-06-15 22:18:12 +02:00
|
|
|
/**
|
|
|
|
* An additional className to apply to the NFT default image
|
|
|
|
*/
|
|
|
|
className: PropTypes.string,
|
2022-06-30 17:46:38 +02:00
|
|
|
};
|