dialog.helperText

Massimo Melina committed Jan 12, 2024 at 10:50 UTC 01dd16e237342654f607437c2f558e0662662db3
1 file changed +3 -2
frontend/src/dialog.ts
+3 -2
@@ -9,8 +9,8 @@ import { t } from './i18n'
9 import { err2msg, isCtrlKey, pendingPromise } from './misc'
10 export * from '@hfs/shared/dialogs'
11
12 -interface PromptOptions extends Partial<DialogOptions> { def?:string, type?:string, trim?: boolean }
13 -export async function promptDialog(msg: string, { def, type, trim=true, ...rest }:PromptOptions={}) : Promise<string | null> {
12 +interface PromptOptions extends Partial<DialogOptions> { def?:string, type?:string, trim?: boolean, helperText?: ReactNode }
13 +export async function promptDialog(msg: string, { def, type, helperText, trim=true, ...rest }:PromptOptions={}) : Promise<string | null> {
14 const textarea = type === 'textarea' && type
15 return new Promise(resolve => newDialog({
16 className: 'dialog-prompt',
@@ -58,6 +58,7 @@ export async function promptDialog(msg: string, { def, type, trim=true, ...rest
58 return go()
59 }
60 }),
61 + helperText && h('div', { style: { fontSize: 'smaller', marginTop: '.2em' } }, helperText),
62 h('div', { style: { textAlign: 'right', marginTop: '.8em' } },
63 h('button', { onClick: go }, t`Continue`)),
64 )