aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/reducers/search.js
blob: 4e2032d6b880bbbbac183464d6aa40bedd2a93b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const DEFAULT_STATE = {
  searchInput: '',
  searchResults: [],
  hasFocus: false,
};

const search = (state = DEFAULT_STATE, action) => {
  switch (action.type) {
    case 'SEARCH/INPUT_CHANGE':
      return {
        ...state,
        searchInput: action.typedValue,
        searchResults: [
          { type: 's', value: '18561' },
          { type: 'c', value: '5H2' },
          { type: 't', value: 'akh' },
          { type: 'r', value: '008-mk' },
        ],
      };
    case 'SEARCH/FOCUS_CHANGE':
      return {
        ...state,
        hasFocus: action.hasFocus,
      };
    default:
      return state;
  }
};

export default search;