gab-social/app/javascript/gabsocial/actions/popover.js

23 lines
574 B
JavaScript
Raw Normal View History

2020-02-28 15:20:47 +00:00
export const POPOVER_OPEN = 'POPOVER_OPEN'
export const POPOVER_CLOSE = 'POPOVER_CLOSE'
2020-11-15 18:48:32 +00:00
export const openPopover = (type, props) => (dispatch, getState) => {
const currentlyOpenPopover = getState().getIn(['popover', 'popoverType'])
2020-05-01 06:50:27 +01:00
2020-11-15 18:48:32 +00:00
if (currentlyOpenPopover === type) {
dispatch(closePopover(type))
} else {
dispatch(handleOpenPopover(type, props))
2020-02-28 15:20:47 +00:00
}
}
2020-11-15 18:48:32 +00:00
export const closePopover = (type) => ({
type: POPOVER_CLOSE,
popoverType: type,
})
2020-05-01 06:50:27 +01:00
2020-11-15 18:48:32 +00:00
const handleOpenPopover = (type, props) => ({
type: POPOVER_OPEN,
popoverType: type,
popoverProps: props,
})