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

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

Loading…
Cancel
Save