2022-06-30 17:46:38 +02:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classnames from 'classnames';
|
2023-08-01 20:21:51 +02:00
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
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,
|
|
|
|
JustifyContent,
|
|
|
|
BorderRadius,
|
|
|
|
} from '../../../helpers/constants/design-system';
|
2022-06-30 17:46:38 +02:00
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
2023-08-01 20:21:51 +02:00
|
|
|
import { ButtonLink, Box } from '../../component-library';
|
|
|
|
import { showIpfsModal } from '../../../store/actions';
|
|
|
|
import { getIpfsGateway } from '../../../selectors';
|
2022-06-30 17:46:38 +02:00
|
|
|
|
2023-08-01 20:21:51 +02:00
|
|
|
export default function NftDefaultImage({ className, clickable }) {
|
2022-06-30 17:46:38 +02:00
|
|
|
const t = useI18nContext();
|
2023-08-01 20:21:51 +02:00
|
|
|
const dispatch = useDispatch();
|
|
|
|
const isIpfsEnabled = useSelector(getIpfsGateway);
|
|
|
|
|
2022-06-30 17:46:38 +02:00
|
|
|
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}
|
|
|
|
borderRadius={BorderRadius.LG}
|
2022-06-30 17:46:38 +02:00
|
|
|
>
|
2023-08-01 20:21:51 +02:00
|
|
|
{!isIpfsEnabled && (
|
|
|
|
<ButtonLink
|
|
|
|
block
|
|
|
|
className="nft-default__button"
|
|
|
|
onClick={(e) => {
|
|
|
|
e.stopPropagation();
|
|
|
|
dispatch(showIpfsModal());
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{t('show')}
|
|
|
|
</ButtonLink>
|
|
|
|
)}
|
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
|
|
|
/**
|
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
|
|
|
};
|