aboutsummaryrefslogtreecommitdiff
path: root/src/content/reducers/find.js
blob: 6042f50e687252cf9babc66d23e28da7e375b1ba (plain) (blame)
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
import actions from 'content/actions';

const defaultState = {
  enabled: false,
  keyword: '',
};

export default function reducer(state = defaultState, action = {}) {
  switch (action.type) {
  case actions.FIND_SHOW:
    return Object.assign({}, state, {
      enabled: true,
    });
  case actions.FIND_HIDE:
    return Object.assign({}, state, {
      enabled: false,
    });
  case actions.FIND_SET_KEYWORD:
    return Object.assign({}, state, {
      keyword: action.keyword,
    });
  default:
    return state;
  }
}