use global modal for popup messages
All checks were successful
delpoy / build-and-deploy (push) Successful in 51s
All checks were successful
delpoy / build-and-deploy (push) Successful in 51s
This commit is contained in:
18
src/lib/context.ts
Normal file
18
src/lib/context.ts
Normal file
@ -0,0 +1,18 @@
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user