aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/reducers/search.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/react/reducers/search.js')
-rw-r--r--src/client/react/reducers/search.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/client/react/reducers/search.js b/src/client/react/reducers/search.js
index 5d8fee5..52f3b4e 100644
--- a/src/client/react/reducers/search.js
+++ b/src/client/react/reducers/search.js
@@ -2,8 +2,8 @@
import fuzzy from 'fuzzy';
const DEFAULT_STATE = {
- searchInput: '',
- searchResults: [
+ input: '',
+ results: [
{ type: 's', value: '18561' },
],
exactMatch: null,
@@ -31,6 +31,8 @@ const search = (state = DEFAULT_STATE, action) => {
let results = getSearchResults(action.typedValue);
let exactMatch = null;
+ // Is the typed value exactly the same as the first result? Then show the
+ // appropiate icon instead of the generic search icon.
if ((results.length > 0) && (action.typedValue === results[0].value)) {
[exactMatch] = results;
results = results.splice(1);
@@ -38,8 +40,8 @@ const search = (state = DEFAULT_STATE, action) => {
return {
...state,
- searchInput: action.typedValue,
- searchResults: results,
+ input: action.typedValue,
+ results,
exactMatch,
};
}