From 39fb5400370b818760dc7bcfe42e74b2512a840d Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 8 Oct 2017 15:04:55 +0900 Subject: separate content --- src/content/reducers/input.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/content/reducers/input.js (limited to 'src/content/reducers/input.js') diff --git a/src/content/reducers/input.js b/src/content/reducers/input.js new file mode 100644 index 0000000..802020f --- /dev/null +++ b/src/content/reducers/input.js @@ -0,0 +1,20 @@ +import actions from 'content/actions'; + +const defaultState = { + keys: '', +}; + +export default function reducer(state = defaultState, action = {}) { + switch (action.type) { + case actions.INPUT_KEY_PRESS: + return Object.assign({}, state, { + keys: state.keys + action.key + }); + case actions.INPUT_CLEAR_KEYS: + return Object.assign({}, state, { + keys: '', + }); + default: + return state; + } +} -- cgit v1.2.3