p5.js-web-editor/shared/redux/reducers/preferences.js

36 lines
779 B
JavaScript
Raw Normal View History

2016-06-17 17:37:29 +00:00
import * as ActionTypes from '../constants/constants';
const initialState = {
2016-06-20 18:58:15 +00:00
isPreferencesShowing: false,
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-20 18:58:15 +00:00
isPreferencesShowing: true,
fontSize: state.fontSize
2016-06-17 18:31:33 +00:00
}
case ActionTypes.CLOSE_PREFERENCES:
return {
2016-06-20 18:58:15 +00:00
isPreferencesShowing: false,
fontSize: state.fontSize
}
case ActionTypes.INCREASE_FONTSIZE:
return {
isPreferencesShowing: state.isPreferencesShowing,
fontSize: state.fontSize+2
}
case ActionTypes.DECREASE_FONTSIZE:
return {
isPreferencesShowing: state.isPreferencesShowing,
fontSize: state.fontSize-2
2016-06-17 17:37:29 +00:00
}
default:
return state
}
}
export default preferences;