Files
website/src/lib/context.ts
bytedream e30446598c
All checks were successful
delpoy / build-and-deploy (push) Successful in 51s
use global modal for popup messages
2024-12-02 21:02:23 +01:00

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;
}