@setoelkahfi / svara / commits / a870964

chore: buttont type for modals

Signed-off-by: mellobacon <mellodev@outlook.com>

mellobacon committed Jan 19, 2024 at 17:31 UTC a870964f17da45a377723e2e8414150a561e143f
1 file changed +11 -2
src/App.svelte
+11 -2
@@ -77,12 +77,21 @@
77 const popup = writable(null);
78 export const fullscreen = writable(false);
79
80 - export function openInputModal(title: string, description: string, buttons: any[], options = undefined, path = "") {
80 + type Button = {
81 + name: string,
82 + action,
83 + disabled?: boolean,
84 + style?: "primary" | "secondary" | "accent" | "danger",
85 + type?: "button" | "submit" | "reset",
86 + cancel?: boolean
87 + }
88 +
89 + export function openInputModal(title: string, description: string, buttons: Button[], options = undefined, path = "") {
90 popup.set(InputModal);
91 popupProps.set({title: title, description: description, buttons: buttons, options: options, open: true, path: path});
92 _openPopup.set(true);
93 }
85 - export function openRenameModal(title: string, description: string, buttons: any[], path: string) {
94 + export function openRenameModal(title: string, description: string, buttons: Button[], path: string) {
95 popup.set(RenameModal);
96 popupProps.set({title: title, description: description, buttons: buttons, open: true, path: path});
97 _openPopup.set(true);