2021-02-04 19:15:23 +01:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import CurrencyInput from '../../ui/currency-input';
|
2018-10-17 01:03:29 +02:00
|
|
|
|
|
|
|
export default class UserPreferencedCurrencyInput extends PureComponent {
|
|
|
|
static propTypes = {
|
2018-10-26 10:26:43 +02:00
|
|
|
useNativeCurrencyAsPrimaryCurrency: PropTypes.bool,
|
2022-01-20 16:42:13 +01:00
|
|
|
sendInputCurrencySwitched: PropTypes.bool,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-17 01:03:29 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2022-01-20 16:42:13 +01:00
|
|
|
const {
|
|
|
|
useNativeCurrencyAsPrimaryCurrency,
|
|
|
|
sendInputCurrencySwitched,
|
|
|
|
...restProps
|
|
|
|
} = this.props;
|
2018-10-17 01:03:29 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<CurrencyInput
|
|
|
|
{...restProps}
|
2022-01-20 16:42:13 +01:00
|
|
|
featureSecondary={Boolean(
|
|
|
|
(useNativeCurrencyAsPrimaryCurrency && sendInputCurrencySwitched) ||
|
|
|
|
(!useNativeCurrencyAsPrimaryCurrency && !sendInputCurrencySwitched),
|
|
|
|
)}
|
2018-10-17 01:03:29 +02:00
|
|
|
/>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-17 01:03:29 +02:00
|
|
|
}
|
|
|
|
}
|