Skip to content

Commit

Permalink
for first 5 inputs the suggestion list should never appear above the …
Browse files Browse the repository at this point in the history
…input
  • Loading branch information
karussell committed Sep 6, 2023
1 parent 916e953 commit f6edc9e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sidebar/search/AddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default function AddressInput(props: AddressInputProps) {
</div>

{autocompleteItems.length > 0 && (
<ResponsiveAutocomplete inputRef={searchInput.current!}>
<ResponsiveAutocomplete inputRef={searchInput.current!} index={props.index}>
<Autocomplete
items={autocompleteItems}
highlightedItem={autocompleteItems[highlightedResult]}
Expand All @@ -185,14 +185,14 @@ export default function AddressInput(props: AddressInputProps) {
)
}

function ResponsiveAutocomplete({ inputRef, children }: { inputRef: HTMLElement; children: ReactNode }): JSX.Element {
function ResponsiveAutocomplete({ inputRef, children, index }: { inputRef: HTMLElement; children: ReactNode; index:number }): JSX.Element {
const isSmallScreen = useMediaQuery({ query: '(max-width: 44rem)' })
return (
<>
{isSmallScreen ? (
children
) : (
<PopUp inputElement={inputRef} keepClearAtBottom={270}>
<PopUp inputElement={inputRef} keepClearAtBottom={index > 5 ? 270 : 0}>
{children}
</PopUp>
)}
Expand Down

0 comments on commit f6edc9e

Please sign in to comment.