aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/actions/search.ts
blob: 45c31fb32d59ca20e3f4c6034814a92ebb892475 (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
export interface InputChangeAction {
  type: 'SEARCH/INPUT_CHANGE',
  typedValue: string,
}

export const inputChange = (typedValue: string): InputChangeAction => ({
  type: 'SEARCH/INPUT_CHANGE',
  typedValue,
});

export interface ChangeSelectedResultAction {
  type: 'SEARCH/CHANGE_SELECTED_RESULT',
  relativeChange: 1 | -1,
}

/**
 * Change the selected result.
 * @param {+1/-1} relativeChange usually +1 or -1, the change relative to the
 *     current result.
 */
export const changeSelectedResult = (relativeChange: 1 | -1): ChangeSelectedResultAction => ({
  type: 'SEARCH/CHANGE_SELECTED_RESULT',
  relativeChange,
});