(setting: Setting, options: ButtonSettingOptions)
| 326 | * Helper for configuring a button setting (works with SettingGroup.addSetting) |
| 327 | */ |
| 328 | export function configureButtonSetting(setting: Setting, options: ButtonSettingOptions): Setting { |
| 329 | return setting |
| 330 | .setName(options.name) |
| 331 | .setDesc(options.desc) |
| 332 | .addButton((button) => { |
| 333 | button.setButtonText(options.buttonText).onClick(() => { |
| 334 | runAsyncSettingCallback(options.onClick); |
| 335 | }); |
| 336 | |
| 337 | if (options.buttonClass) { |
| 338 | button.buttonEl.addClass(options.buttonClass); |
| 339 | } else { |
| 340 | button.buttonEl.addClasses(["tn-btn", "tn-btn--ghost"]); |
| 341 | } |
| 342 | |
| 343 | return button; |
| 344 | }); |
| 345 | } |
| 346 | |
| 347 | /** |
| 348 | * Helper for creating standard button settings |
no test coverage detected