improve theme random accent setting control nesting

This commit is contained in:
zombieFox 2021-09-05 10:03:06 +01:00
parent 6fee85ca1a
commit ce29285ae6

View File

@ -71,10 +71,10 @@ themeSetting.control = {
themeSetting.disable = () => {
if (state.get.current().theme.accent.random.active) {
themeSetting.control.accent.style.enable();
themeSetting.control.accent.random.style.enable();
themeSetting.control.accent.randomiseNow.enable();
} else {
themeSetting.control.accent.style.disable();
themeSetting.control.accent.random.style.disable();
themeSetting.control.accent.randomiseNow.disable();
};
@ -341,7 +341,7 @@ themeSetting.saved = (parent) => {
}
}),
edit: new Button({
text: 'Edit',
text: 'Edit saved themes',
iconName: 'edit',
style: ['line'],
srOnly: true,
@ -594,7 +594,21 @@ themeSetting.accent = (parent) => {
}
});
themeSetting.control.accent.style = new Control_radio({
themeSetting.control.accent.random = {};
themeSetting.control.accent.random.active = new Control_checkbox({
object: state.get.current(),
path: 'theme.accent.random.active',
id: 'theme-accent-random-active',
labelText: 'Random Accent colour on load/refresh',
action: () => {
themeSetting.disable();
themeSetting.control.accent.random.collapse.update();
data.save();
}
});
themeSetting.control.accent.random.style = new Control_radio({
object: state.get.current(),
radioGroup: [
{ id: 'theme-accent-random-style-any', labelText: 'Any', value: 'any' },
@ -610,20 +624,6 @@ themeSetting.accent = (parent) => {
}
});
themeSetting.control.accent.random = {};
themeSetting.control.accent.random.active = new Control_checkbox({
object: state.get.current(),
path: 'theme.accent.random.active',
id: 'theme-accent-random-active',
labelText: 'Random Accent colour on load/refresh',
action: () => {
themeSetting.disable();
themeSetting.control.accent.random.collapse.update();
data.save();
}
});
themeSetting.control.accent.randomiseNow = new Button({
text: 'Randomise now',
style: ['line'],
@ -645,7 +645,7 @@ themeSetting.accent = (parent) => {
});
themeSetting.control.accent.random.area = node('div', [
themeSetting.control.accent.style.inline(),
themeSetting.control.accent.random.style.inline(),
themeSetting.control.accent.randomiseNow.wrap()
]);