p5.js-web-editor/client/modules/IDE/reducers/preferences.js

36 lines
782 B
JavaScript
Raw Normal View History

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-23 22:29:55 +00:00
isVisible: false,
fontSize: 18
};
2016-06-17 17:37:29 +00:00
const preferences = (state = initialState, action) => {
2016-06-23 22:29:55 +00:00
switch (action.type) {
case ActionTypes.OPEN_PREFERENCES:
return {
isVisible: true,
fontSize: state.fontSize
};
case ActionTypes.CLOSE_PREFERENCES:
return {
isVisible: false,
fontSize: state.fontSize
};
case ActionTypes.INCREASE_FONTSIZE:
return {
isVisible: state.isVisible,
fontSize: state.fontSize + 2
};
case ActionTypes.DECREASE_FONTSIZE:
return {
isVisible: state.isVisible,
fontSize: state.fontSize - 2
};
default:
return state;
}
};
2016-06-17 17:37:29 +00:00
2016-06-23 22:29:55 +00:00
export default preferences;