diff --git a/src/components/IntegrationAutosuggest.js b/src/components/IntegrationAutosuggest.js index bcbe5dfd3ee16aa78a656e5d98932d7e731c89ca..9c1ffbdce082413bb45e9bb324091ff1893b9bb3 100644 --- a/src/components/IntegrationAutosuggest.js +++ b/src/components/IntegrationAutosuggest.js @@ -58,6 +58,16 @@ function renderSuggestionsContainer(options) { ); } +function renderSectionTitle(section) { + return ( + <strong>{section.dataset}</strong> + ); +} + +function getSectionSuggestions(section) { + return section.results; +} + function getSuggestionValue(suggestion) { return suggestion.label; } @@ -102,12 +112,15 @@ const IntegrationAutosuggest = (props) => { suggestionsList: classes.suggestionsList, suggestion: classes.suggestion, }} + multiSection={true} renderInputComponent={renderInput} suggestions={props.search.suggestions} onSuggestionsClearRequested={props.clearSuggestions} onSuggestionsFetchRequested={props.fetchSuggestions} renderSuggestionsContainer={renderSuggestionsContainer} getSuggestionValue={getSuggestionValue} + renderSectionTitle={renderSectionTitle} + getSectionSuggestions={getSectionSuggestions} renderSuggestion={renderSuggestion} inputProps={{ classes, diff --git a/src/reducers/search.js b/src/reducers/search.js index 8f6d013936cb890c45b8f8c32e0ba0998b4de66f..225f4994125824c3bea2c550b1885491fddcb8d1 100644 --- a/src/reducers/search.js +++ b/src/reducers/search.js @@ -2,7 +2,7 @@ import { UPDATE_QUERY, FETCH_SUGGESTIONS, UPDATE_DATASETS, UPDATE_SUGGESTIONS, C export const INITIAL_STATE = { query: '', - datasets: ['warsa_karelian_places'], + datasets: ['warsa_karelian_places', 'warsa_municipalities'], suggestions: [], isFetchingSuggestions: false, };