1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-01 21:57:06 +01:00
metamask-extension/ui/components/app/confirm-subtitle/confirm-subtitle.js
George Marshall bf61322ee1
Update Text import paths: /app (#20083)
* Updating import paths

* Updating snapshots

* Fixing lint issues

* Updating snapshots
2023-07-19 15:32:35 -07:00

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;