| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1x 1x 7x 7x 4x 4x 1x 2x | import {CLOSE_POPUP, OPEN_POPUP} from "../action/popup";
const initialState = {name: ''};
export function popup(state = initialState, action) {
const {type, name, position} = action;
switch (type) {
case OPEN_POPUP:
let nextState = name ? Object.assign({}, state, {name: name}) : Object.assign({}, state, initialState);
return position ? {...nextState, position} : nextState;
case CLOSE_POPUP:
return '';
default:
return state;
}
} |