gab-social/app/javascript/gabsocial/reducers/popover.js
2020-04-07 21:06:59 -04:00

25 lines
530 B
JavaScript

import Immutable from 'immutable'
import {
POPOVER_OPEN,
POPOVER_CLOSE,
} from '../actions/popover'
const initialState = Immutable.Map({
popoverType: null,
popoverProps: null,
})
export default function popoverMenu(state = initialState, action) {
switch (action.type) {
case POPOVER_OPEN:
return state.withMutations(map => {
map.set('popoverType', action.popoverType)
map.set('popoverProps', action.popoverProps)
})
case POPOVER_CLOSE:
return initialState
default:
return state
}
}