diff --git a/js/src/admin/components/AdminPage.tsx b/js/src/admin/components/AdminPage.tsx index a0ad75d0a..3170270bb 100644 --- a/js/src/admin/components/AdminPage.tsx +++ b/js/src/admin/components/AdminPage.tsx @@ -75,6 +75,7 @@ export interface HTMLInputSettingsComponentOptions extends CommonSettingsItemOpt const BooleanSettingTypes = ['bool', 'checkbox', 'switch', 'boolean'] as const; const SelectSettingTypes = ['select', 'dropdown', 'selectdropdown'] as const; +const TextareaSettingTypes = ['textarea'] as const; /** * Valid options for the setting component builder to generate a Switch. @@ -95,10 +96,21 @@ export interface SelectSettingComponentOptions extends CommonSettingsItemOptions default: string; } +/** + * Valid options for the setting component builder to generate a Textarea. + */ +export interface TextareaSettingComponentOptions extends CommonSettingsItemOptions { + type: typeof TextareaSettingTypes[number]; +} + /** * All valid options for the setting component builder. */ -export type SettingsComponentOptions = HTMLInputSettingsComponentOptions | SwitchSettingComponentOptions | SelectSettingComponentOptions; +export type SettingsComponentOptions = + | HTMLInputSettingsComponentOptions + | SwitchSettingComponentOptions + | SelectSettingComponentOptions + | TextareaSettingComponentOptions; /** * Valid attrs that can be returned by the `headerInfo` function @@ -212,6 +224,8 @@ export default abstract class AdminPage - -
- {help} -
- ); } else { componentAttrs.className = classList(['FormControl', componentAttrs.className]); - return ( -
- {label && } -
- {help} -
- -
- ); + if ((TextareaSettingTypes as readonly string[]).includes(type)) { + settingElement =