23 lines
574 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-11-15 12:48:32 -06:00
export const openPopover = (type, props) => (dispatch, getState) => {
const currentlyOpenPopover = getState().getIn(['popover', 'popoverType'])
2020-05-01 01:50:27 -04:00
2020-11-15 12:48:32 -06:00
if (currentlyOpenPopover === type) {
dispatch(closePopover(type))
} else {
dispatch(handleOpenPopover(type, props))
2020-02-28 10:20:47 -05:00
}
}
2020-11-15 12:48:32 -06:00
export const closePopover = (type) => ({
type: POPOVER_CLOSE,
popoverType: type,
})
2020-05-01 01:50:27 -04:00
2020-11-15 12:48:32 -06:00
const handleOpenPopover = (type, props) => ({
type: POPOVER_OPEN,
popoverType: type,
popoverProps: props,
})