wip
This commit is contained in:
parent
587136a82d
commit
7eeb90eddc
13 changed files with 392 additions and 54 deletions
33
src/frontend/modal/dialog.ts
Normal file
33
src/frontend/modal/dialog.ts
Normal 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: 'いいえ',
|
||||
};
|
16
src/frontend/modal/menu.ts
Normal file
16
src/frontend/modal/menu.ts
Normal 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;
|
||||
}
|
7
src/frontend/modal/modal.ts
Normal file
7
src/frontend/modal/modal.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { ModalTypeDialog } from './dialog';
|
||||
import { ModalTypeMenu } from './menu';
|
||||
|
||||
export type Modal =
|
||||
| ModalTypeMenu
|
||||
| ModalTypeDialog;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue