2016-06-22 19:58:23 +00:00
|
|
|
import * as ActionTypes from '../../../constants';
|
2016-06-17 17:37:29 +00:00
|
|
|
|
|
|
|
const initialState = {
|
2016-06-22 21:49:29 +00:00
|
|
|
isVisible: false,
|
2016-06-20 18:58:15 +00:00
|
|
|
fontSize: 18
|
2016-06-17 17:37:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const preferences = (state = initialState, action) => {
|
|
|
|
switch (action.type) {
|
2016-06-17 18:31:33 +00:00
|
|
|
case ActionTypes.OPEN_PREFERENCES:
|
2016-06-17 17:37:29 +00:00
|
|
|
return {
|
2016-06-22 21:49:29 +00:00
|
|
|
isVisible: true,
|
2016-06-20 18:58:15 +00:00
|
|
|
fontSize: state.fontSize
|
2016-06-17 18:31:33 +00:00
|
|
|
}
|
|
|
|
case ActionTypes.CLOSE_PREFERENCES:
|
|
|
|
return {
|
2016-06-22 21:49:29 +00:00
|
|
|
isVisible: false,
|
2016-06-20 18:58:15 +00:00
|
|
|
fontSize: state.fontSize
|
|
|
|
}
|
|
|
|
case ActionTypes.INCREASE_FONTSIZE:
|
|
|
|
return {
|
2016-06-22 21:49:29 +00:00
|
|
|
isVisible: state.isVisible,
|
2016-06-20 18:58:15 +00:00
|
|
|
fontSize: state.fontSize+2
|
|
|
|
}
|
|
|
|
case ActionTypes.DECREASE_FONTSIZE:
|
|
|
|
return {
|
2016-06-22 21:49:29 +00:00
|
|
|
isVisible: state.isVisible,
|
2016-06-20 18:58:15 +00:00
|
|
|
fontSize: state.fontSize-2
|
2016-06-17 17:37:29 +00:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-22 19:58:23 +00:00
|
|
|
export default preferences;
|