mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-01 21:57:06 +01:00
bf61322ee1
* Updating import paths * Updating snapshots * Fixing lint issues * Updating snapshots
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;
|