import React from 'react'; import { useTranslation } from 'react-i18next'; import { SliderThumb, Grid, Typography, TextField, Select, MenuItem, Box, useTheme, } from '@mui/material'; import { FlagWithProps } from '../Icons'; import RangeSlider from './RangeSlider'; import currencyDict from '../../../static/assets/currencies.json'; import { pn } from '../../utils'; const RangeThumbComponent: React.FC = (props) => { const { children, ...other } = props; return ( {children} ); }; interface AmountRangeProps { minAmount: string; maxAmount: string; type: number; currency: number; handleRangeAmountChange: (e: any, activeThumb: any) => void; handleMaxAmountChange: ( e: React.ChangeEventHandler, ) => void; handleMinAmountChange: ( e: React.ChangeEventHandler, ) => void; handleCurrencyChange: (newCurrency: number) => void; maxAmountError: boolean; minAmountError: boolean; currencyCode: string; amountLimits: number[]; } const AmountRange: React.FC = ({ minAmount, handleRangeAmountChange, currency, currencyCode, handleCurrencyChange, amountLimits, maxAmount, minAmountError, maxAmountError, handleMinAmountChange, handleMaxAmountChange, }) => { const theme = useTheme(); const { t } = useTranslation(); return ( {t('From')} {t('to')}
pn(parseFloat(Number(x).toPrecision(x < 100 ? 2 : 3))) + ' ' + currencyCode } marks={[ { value: amountLimits[0], label: `${pn( parseFloat(Number(amountLimits[0]).toPrecision(3)), )} ${currencyCode}`, }, { value: amountLimits[1], label: `${pn( parseFloat(Number(amountLimits[1]).toPrecision(3)), )} ${currencyCode}`, }, ]} min={amountLimits[0]} max={amountLimits[1]} onChange={handleRangeAmountChange} /> ); }; export default AmountRange;