Skip to content
Snippets Groups Projects
Commit 184a1c8c authored by Esko Ikkala's avatar Esko Ikkala
Browse files

Add sections to suggestions


Co-authored-by: default avatarErkki Heino <erkki.heino@aalto.fi>
parent 40fb4dbb
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,16 @@ function renderSuggestionsContainer(options) { ...@@ -58,6 +58,16 @@ function renderSuggestionsContainer(options) {
); );
} }
function renderSectionTitle(section) {
return (
<strong>{section.dataset}</strong>
);
}
function getSectionSuggestions(section) {
return section.results;
}
function getSuggestionValue(suggestion) { function getSuggestionValue(suggestion) {
return suggestion.label; return suggestion.label;
} }
...@@ -102,12 +112,15 @@ const IntegrationAutosuggest = (props) => { ...@@ -102,12 +112,15 @@ const IntegrationAutosuggest = (props) => {
suggestionsList: classes.suggestionsList, suggestionsList: classes.suggestionsList,
suggestion: classes.suggestion, suggestion: classes.suggestion,
}} }}
multiSection={true}
renderInputComponent={renderInput} renderInputComponent={renderInput}
suggestions={props.search.suggestions} suggestions={props.search.suggestions}
onSuggestionsClearRequested={props.clearSuggestions} onSuggestionsClearRequested={props.clearSuggestions}
onSuggestionsFetchRequested={props.fetchSuggestions} onSuggestionsFetchRequested={props.fetchSuggestions}
renderSuggestionsContainer={renderSuggestionsContainer} renderSuggestionsContainer={renderSuggestionsContainer}
getSuggestionValue={getSuggestionValue} getSuggestionValue={getSuggestionValue}
renderSectionTitle={renderSectionTitle}
getSectionSuggestions={getSectionSuggestions}
renderSuggestion={renderSuggestion} renderSuggestion={renderSuggestion}
inputProps={{ inputProps={{
classes, classes,
......
...@@ -2,7 +2,7 @@ import { UPDATE_QUERY, FETCH_SUGGESTIONS, UPDATE_DATASETS, UPDATE_SUGGESTIONS, C ...@@ -2,7 +2,7 @@ import { UPDATE_QUERY, FETCH_SUGGESTIONS, UPDATE_DATASETS, UPDATE_SUGGESTIONS, C
export const INITIAL_STATE = { export const INITIAL_STATE = {
query: '', query: '',
datasets: ['warsa_karelian_places'], datasets: ['warsa_karelian_places', 'warsa_municipalities'],
suggestions: [], suggestions: [],
isFetchingSuggestions: false, isFetchingSuggestions: false,
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment