diff --git a/apps/contract-verification/src/app/components/SearchableChainDropdown.tsx b/apps/contract-verification/src/app/components/SearchableChainDropdown.tsx index b20c38cde0c..edc0ae54747 100644 --- a/apps/contract-verification/src/app/components/SearchableChainDropdown.tsx +++ b/apps/contract-verification/src/app/components/SearchableChainDropdown.tsx @@ -1,8 +1,9 @@ -import React, { useState, useEffect, useRef, useMemo } from 'react' +import React, { useState, useEffect, useRef, useMemo, Ref } from 'react' import Fuse from 'fuse.js' import type { Chain } from '../types' import { AppContext } from '../AppContext' -import { useIntl } from 'react-intl' +import intl, { useIntl } from 'react-intl' +import { Dropdown } from 'react-bootstrap' function getChainDescriptor(chain: Chain): string { if (!chain) return '' @@ -16,6 +17,74 @@ interface DropdownProps { selectedChain: Chain } +export const CustomToggle = React.forwardRef( + ( + { + children, + onClick, + icon, + className = '' + }: { + children: React.ReactNode + onClick: (e) => void + icon: string + className: string + }, + ref: Ref + ) => ( + + ) +) + +// export const CustomInputToggle = React.forwardRef( +// ( +// { +// children, +// onClick, +// icon, +// className = '' +// }: { +// children: React.ReactNode +// onClick: (e) => void +// icon: string +// className: string +// }, +// ref: Ref +// ) => { +// const intl = useIntl() +// return ( +// { +// e.preventDefault() +// onClick(e) +// }} +// className={className.replace('dropdown-toggle', '')} +// /> +// )} +// ) + export const SearchableChainDropdown: React.FC = ({ label, id, setSelectedChain, selectedChain }) => { const { chains } = React.useContext(AppContext) const ethereumChainIds = [1, 11155111, 17000] @@ -87,6 +156,38 @@ export const SearchableChainDropdown: React.FC = ({ label, id, se ) } + const CustomInputToggle = React.forwardRef( + ( + { + children, + onClick, + icon, + className = '' + }: { + children: React.ReactNode + onClick: (e) => void + icon: string + className: string + }, + ref: Ref + ) => { + const intl = useIntl() + return ( + { + e.preventDefault() + onClick(e) + }} + onChange={handleInputChange} + value={searchTerm} + className={className.replace('dropdown-toggle', '')} + /> + )} + ) + return (
{' '} @@ -101,7 +202,7 @@ export const SearchableChainDropdown: React.FC = ({ label, id, se placeholder={intl.formatMessage({ id: "contract-verification.searchableChainDropdown", defaultMessage: "Select a chain" })} className="form-control" /> -
    +
      {filteredOptions.map((chain) => (