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
|
|
|
};
|
|
|
|
|
|
|
|
ReducerRegistry.register(
|
2018-02-06 18:14:05 +00:00
|
|
|
'features/base/responsive-ui',
|
2018-02-14 18:28:22 +00:00
|
|
|
(state = DEFAULT_STATE, action) => {
|
2017-11-07 14:28:08 +00:00
|
|
|
switch (action.type) {
|
|
|
|
case SET_ASPECT_RATIO:
|
|
|
|
return set(state, 'aspectRatio', action.aspectRatio);
|
2018-02-02 13:39:27 +00:00
|
|
|
|
|
|
|
case SET_REDUCED_UI:
|
|
|
|
return set(state, 'reducedUI', action.reducedUI);
|
2017-11-07 14:28:08 +00:00
|
|
|
}
|
2017-10-13 16:13:46 +00:00
|
|
|
|
2017-11-07 14:28:08 +00:00
|
|
|
return state;
|
|
|
|
});
|