mirror of
https://github.com/Drop-OSS/drop-base.git
synced 2025-11-10 04:22:15 +10:00
feat(modal): fix confirm and add notification
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import type { Component } from "vue";
|
||||
import ConfirmationModal from "../components/ConfirmationModal.vue";
|
||||
import NotificationModal from "../components/NotificationModal.vue";
|
||||
|
||||
export type ModalCallbackType<T extends ModalType> = (
|
||||
event: ModalEvents[T],
|
||||
@ -16,21 +17,30 @@ export interface ModalStackElement<T extends ModalType> {
|
||||
|
||||
export enum ModalType {
|
||||
Confirmation,
|
||||
Notification,
|
||||
}
|
||||
|
||||
export type ModalEvents = {
|
||||
[ModalType.Confirmation]: "confirm" | "cancel";
|
||||
[ModalType.Notification]: "close";
|
||||
};
|
||||
|
||||
export type ModalDatas = {
|
||||
[ModalType.Confirmation]: {
|
||||
title: string;
|
||||
description: string;
|
||||
buttonText?: string;
|
||||
};
|
||||
[ModalType.Notification]: {
|
||||
title: string;
|
||||
description: string;
|
||||
buttonText?: string;
|
||||
};
|
||||
};
|
||||
|
||||
const modalComponents: { [key in ModalType]: Component } = {
|
||||
[ModalType.Confirmation]: ConfirmationModal,
|
||||
[ModalType.Notification]: NotificationModal,
|
||||
};
|
||||
|
||||
export function createModal<T extends ModalType>(
|
||||
|
||||
Reference in New Issue
Block a user