2022-11-16 05:32:32 -08:00
|
|
|
import type { ModalType } from 'soapbox/features/ui/components/modal-root';
|
2022-11-12 06:18:24 -08:00
|
|
|
|
2020-03-27 13:59:38 -07:00
|
|
|
export const MODAL_OPEN = 'MODAL_OPEN';
|
|
|
|
export const MODAL_CLOSE = 'MODAL_CLOSE';
|
|
|
|
|
2022-04-10 18:31:24 -07:00
|
|
|
/** Open a modal of the given type */
|
2022-11-12 06:18:24 -08:00
|
|
|
export function openModal(type: ModalType, props?: any) {
|
2020-03-27 13:59:38 -07:00
|
|
|
return {
|
|
|
|
type: MODAL_OPEN,
|
|
|
|
modalType: type,
|
|
|
|
modalProps: props,
|
|
|
|
};
|
2021-08-03 12:22:51 -07:00
|
|
|
}
|
2020-03-27 13:59:38 -07:00
|
|
|
|
2022-04-10 18:31:24 -07:00
|
|
|
/** Close the modal */
|
2022-11-12 06:18:24 -08:00
|
|
|
export function closeModal(type?: ModalType) {
|
2020-03-27 13:59:38 -07:00
|
|
|
return {
|
|
|
|
type: MODAL_CLOSE,
|
2021-08-28 05:52:39 -07:00
|
|
|
modalType: type,
|
2020-03-27 13:59:38 -07:00
|
|
|
};
|
2021-08-03 12:22:51 -07:00
|
|
|
}
|