import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Typography, Grid, ToggleButton, ToggleButtonGroup, Select, Divider, MenuItem, Box, } from '@mui/material'; import currencyDict from '../../../static/assets/currencies.json'; import { useTheme } from '@mui/system'; import { AutocompletePayments } from '../MakerForm'; import { fiatMethods, swapMethods, PaymentIcon } from '../PaymentMethods'; import { FlagWithProps } from '../Icons'; import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank'; interface BookControlProps { width: number; type: number; currency: number; paymentMethod: string[]; onCurrencyChange: () => void; onTypeChange: () => void; setPaymentMethods: () => void; } const BookControl = ({ width, type, currency, onCurrencyChange, onTypeChange, paymentMethod, setPaymentMethods, }: BookControlProps): JSX.Element => { const { t } = useTranslation(); const theme = useTheme(); const smallestToolbarWidth = (t('Buy').length + t('Sell').length) * 0.7 + 12; const mediumToolbarWidth = smallestToolbarWidth + 12; const verboseToolbarWidth = mediumToolbarWidth + (t('and use').length + t('pay with').length) * 0.6; return ( {width > verboseToolbarWidth ? ( {t('I want to')} ) : null} {t('Buy')} {t('Sell')} {width > verboseToolbarWidth ? ( {t('and use')} ) : null} {width > verboseToolbarWidth ? ( {currency == 1000 ? t('swap to') : t('pay with')} ) : null} {width > mediumToolbarWidth ? ( ) : null} {width > smallestToolbarWidth && width < mediumToolbarWidth ? ( ) : null} ); }; export default BookControl;