diff --git a/src/components/SearchAutocompleteDropdown.css b/src/components/SearchAutocompleteDropdown.css deleted file mode 100644 index 456e9a57..00000000 --- a/src/components/SearchAutocompleteDropdown.css +++ /dev/null @@ -1,21 +0,0 @@ -.SearchAutocompleteDropdown { - flex-grow: 1; - pointer-events: auto; -} - -.SearchAutocompleteDropdown_place { - font-size: 13px; - align-items: center; - display: flex; - flex-direction: row; -} - -.SearchAutocompleteDropdown_icon { - margin: 0 8px; - top: 2px; - position: relative; -} - -.SearchAutocompleteDropdown_placeDescription { - vertical-align: middle; -} diff --git a/src/components/SearchAutocompleteDropdown.jsx b/src/components/SearchAutocompleteDropdown.jsx index e50d2b94..081e820e 100644 --- a/src/components/SearchAutocompleteDropdown.jsx +++ b/src/components/SearchAutocompleteDropdown.jsx @@ -1,6 +1,7 @@ import * as React from 'react'; import { useIntl } from 'react-intl'; import { useDispatch, useSelector, shallowEqual } from 'react-redux'; +import classnames from 'classnames'; import { removeRecentlyUsedLocation } from '../features/geocoding'; import { LocationSourceType, @@ -15,8 +16,6 @@ import SelectionListItem from './SelectionListItem'; import { ReactComponent as Position } from 'iconoir/icons/position.svg'; -import './SearchAutocompleteDropdown.css'; - const LIST_ITEM_CLASSNAME = 'SearchAutocompleteDropdown_place'; let _resultMousedownTime = 0; @@ -159,43 +158,36 @@ export default function SearchAutocompleteDropdown(props) { }; return ( - - {showCurrentLocationOption && ( - - - - - - {currentLocationString} - - - )} - {features.map((feature, index) => ( - - + + {showCurrentLocationOption && ( + + + + } + text={currentLocationString} /> - - {describePlace(feature)} - - - ))} - + )} + {features.map((feature, index) => ( + } + text={describePlace(feature)} + /> + ))} + + ); } @@ -210,3 +202,22 @@ export function isAutocompleteResultElement(domElement) { export function getLastAutocompleteResultMousedownTime() { return _resultMousedownTime; } + +function AutocompleteItem({ onClick, onMouseDown, onRemoveClick, icon, text }) { + return ( + + {React.cloneElement(icon, { + className: 'relative top-0.5 my-0 -ml-2 md:ml-6 mr-2', + })} + {text} + + ); +}