import { Box, chakra } from '@chakra-ui/react'; import React from 'react'; import type { FormattedData } from './types'; import * as mixpanel from 'lib/mixpanel/index'; import { Button } from 'toolkit/chakra/button'; import { space, thinsp } from 'toolkit/utils/htmlEntities'; import IconSvg from 'ui/shared/IconSvg'; import { getTokensTotalInfo } from '../utils/tokenUtils'; interface Props { isOpen: boolean; isLoading?: boolean; data: FormattedData; } const TokenSelectButton = ({ isOpen, isLoading, data, ...rest }: Props, ref: React.ForwardedRef) => { const { usd, num, isOverflow } = getTokensTotalInfo(data); const prefix = isOverflow ? ` >${ thinsp }` : ''; const handleClick = React.useCallback(() => { if (isLoading && !isOpen) { return; } mixpanel.logEvent(mixpanel.EventTypes.PAGE_WIDGET, { Type: 'Tokens dropdown' }); }, [ isLoading, isOpen ]); return ( ); }; export default React.forwardRef(TokenSelectButton);