29 lines
637 B
JavaScript
Raw Normal View History

2020-02-28 10:20:47 -05:00
export const POPOVER_OPEN = 'POPOVER_OPEN'
export const POPOVER_CLOSE = 'POPOVER_CLOSE'
2020-03-11 19:56:18 -04:00
export function openPopover(type, props) {
2020-05-01 01:50:27 -04:00
return function (dispatch, getState) {
const currentlyOpenPopover = getState().getIn(['popover', 'popoverType'])
if (currentlyOpenPopover === type) {
dispatch(closePopover(type))
} else {
dispatch(handleOpenPopover(type, props))
}
2020-02-28 10:20:47 -05:00
}
}
export function closePopover(type) {
return {
type: POPOVER_CLOSE,
popoverType: type,
}
}
2020-05-01 01:50:27 -04:00
const handleOpenPopover = (type, props) => {
return {
type: POPOVER_OPEN,
popoverType: type,
popoverProps: props,
}
}