You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

31 lines
738 B

7 years ago
import actions from 'content/actions';
7 years ago
const defaultState = {
enabled: false,
newTab: false,
background: false,
keys: '',
7 years ago
};
export default function reducer(state = defaultState, action = {}) {
switch (action.type) {
case actions.FOLLOW_CONTROLLER_ENABLE:
6 years ago
return { ...state,
7 years ago
enabled: true,
newTab: action.newTab,
background: action.background,
6 years ago
keys: '', };
case actions.FOLLOW_CONTROLLER_DISABLE:
6 years ago
return { ...state,
enabled: false, };
case actions.FOLLOW_CONTROLLER_KEY_PRESS:
6 years ago
return { ...state,
keys: state.keys + action.key, };
case actions.FOLLOW_CONTROLLER_BACKSPACE:
6 years ago
return { ...state,
keys: state.keys.slice(0, -1), };
7 years ago
default:
return state;
}
}