feature/default_network_editable
David Walsh 4 years ago
parent 15aba70e74
commit 14fff6dcf2
  1. 13
      ui/app/pages/swaps/dropdown-search-list/dropdown-search-list.js
  2. 2
      ui/app/pages/swaps/searchable-item-list/item-list/item-list.component.js

@ -26,19 +26,18 @@ export default function DropdownSearchList ({
hideItemIf,
listContainerClassName,
}) {
const t = useContext(I18nContext)
const [isOpen, setIsOpen] = useState(false)
const [selectedItem, setSelectedItem] = useState(startingItem)
const close = () => {
setIsOpen(false)
onClose && onClose()
}
const t = useContext(I18nContext)
const [isOpen, setIsOpen] = useState(false)
const [selectedItem, setSelectedItem] = useState(startingItem)
const onClickItem = useCallback((item) => {
onSelect && onSelect(item)
setSelectedItem(item)
close();
}, [onClose, onSelect])
close()
}, [onSelect])
const onClickSelector = useCallback(() => {
if (!isOpen) {
@ -65,7 +64,7 @@ export default function DropdownSearchList ({
<button
className={classnames('dropdown-search-list', className)}
onClick={onClickSelector}
onKeyUp={e => e.key === 'Escape' && close()}
onKeyUp={(e) => e.key === 'Escape' && close()}
>
{!isOpen && (
<div

@ -54,7 +54,7 @@ export default function ItemList ({
'searchable-item-list__item--disabled': disabled,
})}
onClick={onClick}
onKeyUp={e => e.key === "Enter" && onClick()}
onKeyUp={(e) => e.key === 'Enter' && onClick()}
key={`searchable-item-list-item-${i}`}
>
{(iconUrl || primaryLabel) && (<UrlIcon url={iconUrl} name={primaryLabel} />)}

Loading…
Cancel
Save