Extract variable

This commit is contained in:
RMidhunSuresh 2022-05-30 12:06:23 +05:30
parent efb1a67470
commit 9e79b632a8

View file

@ -158,12 +158,18 @@ export class SettingsView extends TemplateView {
}
optionTags.push( t.option({ value: details.id ?? "", selected: isSelected} , name));
}
const select = t.select({ onChange: (e) => vm.changeThemeOption(e.target.value) }, optionTags);
const select = t.select({
onChange: (e) => {
const themeId = e.target.value;
vm.changeThemeOption(themeId)
}
}, optionTags);
const radioButtons = t.form({
className: { hidden: () => select.options[select.selectedIndex].value !== "" },
onChange: (e) => {
const selectedThemeName = select.options[select.selectedIndex].text;
const themeId = vm.themeMapping[selectedThemeName][e.target.value].id;
const colorScheme = e.target.value;
const themeId = vm.themeMapping[selectedThemeName][colorScheme].id;
vm.changeThemeOption(themeId);
}
},