2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classnames from 'classnames';
|
|
|
|
import UserPreferencedCurrencyDisplay from '../../user-preferenced-currency-display';
|
|
|
|
import { PRIMARY, SECONDARY } from '../../../../helpers/constants/common';
|
2018-06-23 08:52:45 +02:00
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
const ConfirmDetailRow = (props) => {
|
2018-06-23 08:52:45 +02:00
|
|
|
const {
|
|
|
|
label,
|
2018-10-17 01:03:29 +02:00
|
|
|
primaryText,
|
|
|
|
secondaryText,
|
2018-06-23 08:52:45 +02:00
|
|
|
onHeaderClick,
|
2018-10-17 01:03:29 +02:00
|
|
|
primaryValueTextColor,
|
2018-06-23 08:52:45 +02:00
|
|
|
headerText,
|
|
|
|
headerTextClassName,
|
2018-10-17 01:03:29 +02:00
|
|
|
value,
|
2021-02-04 19:15:23 +01:00
|
|
|
} = props;
|
2018-06-23 08:52:45 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="confirm-detail-row">
|
2020-11-03 00:41:28 +01:00
|
|
|
<div className="confirm-detail-row__label">{label}</div>
|
2018-06-23 08:52:45 +02:00
|
|
|
<div className="confirm-detail-row__details">
|
2020-11-03 00:41:28 +01:00
|
|
|
{headerText && (
|
|
|
|
<div
|
|
|
|
className={classnames(
|
|
|
|
'confirm-detail-row__header-text',
|
|
|
|
headerTextClassName,
|
|
|
|
)}
|
2020-11-05 16:35:58 +01:00
|
|
|
onClick={() => onHeaderClick?.()}
|
2020-11-03 00:41:28 +01:00
|
|
|
>
|
|
|
|
{headerText}
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
{primaryText ? (
|
|
|
|
<div
|
|
|
|
className="confirm-detail-row__primary"
|
|
|
|
style={{ color: primaryValueTextColor }}
|
|
|
|
>
|
|
|
|
{primaryText}
|
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
<UserPreferencedCurrencyDisplay
|
|
|
|
className="confirm-detail-row__primary"
|
|
|
|
type={PRIMARY}
|
|
|
|
value={value}
|
|
|
|
showEthLogo
|
2022-03-25 18:35:11 +01:00
|
|
|
ethLogoHeight={18}
|
2020-11-03 00:41:28 +01:00
|
|
|
style={{ color: primaryValueTextColor }}
|
|
|
|
hideLabel
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{secondaryText ? (
|
|
|
|
<div className="confirm-detail-row__secondary">{secondaryText}</div>
|
|
|
|
) : (
|
|
|
|
<UserPreferencedCurrencyDisplay
|
|
|
|
className="confirm-detail-row__secondary"
|
|
|
|
type={SECONDARY}
|
|
|
|
value={value}
|
|
|
|
showEthLogo
|
|
|
|
hideLabel
|
|
|
|
/>
|
|
|
|
)}
|
2018-06-23 08:52:45 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
};
|
2018-06-23 08:52:45 +02:00
|
|
|
|
|
|
|
ConfirmDetailRow.propTypes = {
|
|
|
|
headerText: PropTypes.string,
|
|
|
|
headerTextClassName: PropTypes.string,
|
2018-10-17 01:03:29 +02:00
|
|
|
label: PropTypes.string,
|
|
|
|
onHeaderClick: PropTypes.func,
|
|
|
|
primaryValueTextColor: PropTypes.string,
|
|
|
|
primaryText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
|
|
secondaryText: PropTypes.string,
|
|
|
|
value: PropTypes.string,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-06-23 08:52:45 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export default ConfirmDetailRow;
|