mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 11:28:51 +01:00
deabc3ed5f
* repalcing deprecated constants * resolve issue * lint fixes --------- Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import { SECONDARY } from '../../../helpers/constants/common';
|
|
import { Color, TextVariant } from '../../../helpers/constants/design-system';
|
|
import { isNFTAssetStandard } from '../../../helpers/utils/transactions.util';
|
|
import { getShouldShowFiat } from '../../../selectors';
|
|
import { useTransactionInfo } from '../../../hooks/useTransactionInfo';
|
|
import { Text } from '../../component-library';
|
|
import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display';
|
|
|
|
const ConfirmSubTitle = ({
|
|
txData,
|
|
hexTransactionAmount,
|
|
subtitleComponent,
|
|
assetStandard,
|
|
}) => {
|
|
const shouldShowFiat = useSelector(getShouldShowFiat);
|
|
const { isNftTransfer } = useTransactionInfo(txData);
|
|
|
|
if (!shouldShowFiat && !isNftTransfer && !isNFTAssetStandard(assetStandard)) {
|
|
return null;
|
|
}
|
|
|
|
if (subtitleComponent) {
|
|
return subtitleComponent;
|
|
}
|
|
|
|
return (
|
|
<Text
|
|
as="h5"
|
|
ellipsis
|
|
variant={TextVariant.bodyMd}
|
|
color={Color.textAlternative}
|
|
>
|
|
<UserPreferencedCurrencyDisplay
|
|
value={hexTransactionAmount}
|
|
type={SECONDARY}
|
|
showEthLogo
|
|
hideLabel
|
|
/>
|
|
</Text>
|
|
);
|
|
};
|
|
|
|
ConfirmSubTitle.propTypes = {
|
|
assetStandard: PropTypes.string,
|
|
hexTransactionAmount: PropTypes.string,
|
|
subtitleComponent: PropTypes.element,
|
|
txData: PropTypes.object.isRequired,
|
|
};
|
|
|
|
export default ConfirmSubTitle;
|