2018-02-14 18:28:22 +00:00
|
|
|
// @flow
|
|
|
|
|
2017-10-13 16:13:46 +00:00
|
|
|
import { ReducerRegistry, set } from '../redux';
|
|
|
|
|
2018-02-02 13:39:27 +00:00
|
|
|
import { SET_ASPECT_RATIO, SET_REDUCED_UI } from './actionTypes';
|
2017-10-13 16:13:46 +00:00
|
|
|
import { ASPECT_RATIO_NARROW } from './constants';
|
|
|
|
|
2017-11-07 14:28:08 +00:00
|
|
|
/**
|
2018-02-14 18:28:22 +00:00
|
|
|
* The default/initial redux state of the feature base/responsive-ui.
|
2017-11-07 14:28:08 +00:00
|
|
|
*/
|
2018-02-14 18:28:22 +00:00
|
|
|
const DEFAULT_STATE = {
|
2018-02-02 13:39:27 +00:00
|
|
|
aspectRatio: ASPECT_RATIO_NARROW,
|
|
|
|
reducedUI: false
|
2017-10-13 16:13:46 +00:00
|
|
|
};
|
|
|
|
|
2019-11-08 16:42:39 +00:00
|
|
|
ReducerRegistry.register('features/base/responsive-ui', (state = DEFAULT_STATE, action) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case SET_ASPECT_RATIO:
|
|
|
|
return set(state, 'aspectRatio', action.aspectRatio);
|
2018-02-02 13:39:27 +00:00
|
|
|
|
2019-11-08 16:42:39 +00:00
|
|
|
case SET_REDUCED_UI:
|
|
|
|
return set(state, 'reducedUI', action.reducedUI);
|
|
|
|
}
|
2017-10-13 16:13:46 +00:00
|
|
|
|
2019-11-08 16:42:39 +00:00
|
|
|
return state;
|
|
|
|
});
|