import React, { useContext, useState } from 'react'; import PropTypes from 'prop-types'; import { I18nContext } from '../../../../contexts/i18n'; import Box from '../../../ui/box'; import Button from '../../../ui/button'; import Typography from '../../../ui/typography/typography'; import { DISPLAY, FONT_WEIGHT, TYPOGRAPHY, } from '../../../../helpers/constants/design-system'; const DetectedTokenAggregators = ({ aggregatorsList }) => { const t = useContext(I18nContext); const numOfHiddenAggregators = parseInt(aggregatorsList.length, 10) - 2; const [displayMore, setDisplayMore] = useState(false); return ( {t('fromTokenLists', [ numOfHiddenAggregators > 0 && !displayMore ? ( {`${aggregatorsList.slice(0, 2).join(', ')}`} ) : ( {`${aggregatorsList.join(', ')}.`} ), ])} ); }; DetectedTokenAggregators.propTypes = { aggregatorsList: PropTypes.array.isRequired, }; export default DetectedTokenAggregators;