import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { useI18nContext } from '../../../../hooks/useI18nContext'; import Box from '../../../ui/box'; import Button from '../../../ui/button'; import { DISPLAY, FontWeight, TextVariant, } from '../../../../helpers/constants/design-system'; import { Text } from '../../../component-library'; const NUMBER_OF_AGGREGATORS_TO_DISPLAY = 2; const DetectedTokenAggregators = ({ aggregators }) => { const t = useI18nContext(); const numOfHiddenAggregators = parseInt(aggregators.length, 10) - NUMBER_OF_AGGREGATORS_TO_DISPLAY; const [displayMore, setDisplayMore] = useState(false); return ( {t('fromTokenLists', [ numOfHiddenAggregators > 0 && !displayMore ? ( {`${aggregators .slice(0, NUMBER_OF_AGGREGATORS_TO_DISPLAY) .join(', ')}`} ) : ( {`${aggregators.join(', ')}.`} ), ])} ); }; DetectedTokenAggregators.propTypes = { aggregators: PropTypes.array.isRequired, }; export default DetectedTokenAggregators;