0
0
Fork 0
This commit is contained in:
Xeltica 2021-09-14 04:11:43 +09:00
parent 587136a82d
commit 7eeb90eddc
13 changed files with 392 additions and 54 deletions

View file

@ -0,0 +1,33 @@
export interface ModalTypeDialog {
type: 'dialog';
title?: string;
message: string;
icon?: DialogIcon;
buttons?: DialogButtonType;
onSelect?: (clickedButtonIndex: number) => void;
}
export type DialogIcon = 'info' | 'warning' | 'error' | 'question';
export type DialogButtonType = 'ok' | 'yesNo' | DialogButton[];
export type DialogButtonStyle = 'primary' | 'danger';
export interface DialogButton {
text: string;
style?: DialogButtonStyle;
}
export const builtinDialogButtonOk: DialogButton = {
text: 'OK',
style: 'primary',
};
export const builtinDialogButtonYes: DialogButton = {
text: 'はい',
style: 'primary',
};
export const builtinDialogButtonNo: DialogButton = {
text: 'いいえ',
};

View file

@ -0,0 +1,16 @@
export interface ModalTypeMenu {
type: 'menu';
screenX: number;
screenY: number;
items: MenuItem[];
}
export type MenuItemClassName = `bi bi-${string}`;
export interface MenuItem {
icon?: MenuItemClassName;
name: string;
onClick: VoidFunction;
disabled?: boolean;
danger?: boolean;
}

View file

@ -0,0 +1,7 @@
import { ModalTypeDialog } from './dialog';
import { ModalTypeMenu } from './menu';
export type Modal =
| ModalTypeMenu
| ModalTypeDialog;