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

Simpler suggestions

parent 98b0b2c6
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,7 @@ function renderSuggestionsContainer(options) {
}
function getSuggestionValue(suggestion) {
return suggestion.label;
return suggestion;
}
const styles = theme => ({
......
......@@ -8,17 +8,19 @@ const styles = {
fontWeight: 300,
height: 10
};
//
// const getCounts = (suggestion) => suggestion.datasets.map((dataset, index) => (
// <span key={dataset.datasetId}>
// {index > 0 ? ', ' : ''}
// {`${dataset.shortTitle}: ${dataset.count.value}`}
// </span>
// ));
const getCounts = (suggestion) => suggestion.datasets.map((dataset, index) => (
<span key={dataset.datasetId}>
{index > 0 ? ', ' : ''}
{`${dataset.shortTitle}: ${dataset.count.value}`}
</span>
));
// <span> ({getCounts(suggestion)})</span>
const SuggestionItem = ({ suggestion, query, isHighlighted }) => {
const matches = match(suggestion.label, query);
const parts = parse(suggestion.label, matches);
const matches = match(suggestion, query);
const parts = parse(suggestion, matches);
return (
<MenuItem
......@@ -39,14 +41,13 @@ const SuggestionItem = ({ suggestion, query, isHighlighted }) => {
</span>
);
})}
<span> ({getCounts(suggestion)})</span>
</div>
</MenuItem>
);
};
SuggestionItem.propTypes = {
suggestion: PropTypes.object.isRequired,
suggestion: PropTypes.string.isRequired,
query: PropTypes.string.isRequired,
isHighlighted: PropTypes.bool.isRequired,
};
......
......@@ -8,7 +8,7 @@ import {
UPDATE_RESULTS,
CLEAR_RESULTS
} from '../actions';
import suggestions from './suggestions';
//import suggestions from './suggestions';
import results from './results';
export const INITIAL_STATE = {
......@@ -42,7 +42,7 @@ const search = (state = INITIAL_STATE, action) => {
case UPDATE_SUGGESTIONS:
return {
...state,
suggestions: suggestions(state.suggestions, action),
suggestions: action.suggestions,
suggestionsQuery: state.query,
fetchingSuggestions: 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