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

36 lines
779 B
JavaScript
Raw Normal View History

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