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

36 lines
782 B
JavaScript
Raw Normal View History

2016-06-22 21:58:23 +02:00
import * as ActionTypes from '../../../constants';
2016-06-17 19:37:29 +02:00
const initialState = {
2016-06-24 00:29:55 +02:00
isVisible: false,
fontSize: 18
};
2016-06-17 19:37:29 +02:00
const preferences = (state = initialState, action) => {
2016-06-24 00:29:55 +02: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 19:37:29 +02:00
2016-06-24 00:29:55 +02:00
export default preferences;