19 lines
453 B
TypeScript
19 lines
453 B
TypeScript
import { getContext } from 'svelte';
|
|
|
|
export type PopupModalContextArgs = {
|
|
title: string;
|
|
text?: string;
|
|
actions?: { text: string; action?: (modal: Event) => void }[];
|
|
onClose?: () => void;
|
|
};
|
|
export function getPopupModalShowFn(): ({
|
|
title,
|
|
text,
|
|
actions,
|
|
onClose
|
|
}: PopupModalContextArgs) => void {
|
|
const { set }: { set: ({ title, text, actions, onClose }: PopupModalContextArgs) => void } =
|
|
getContext('globalPopupModal');
|
|
return set;
|
|
}
|