Custom radio inputs

This commit is contained in:
yflory
2018-04-16 19:07:54 +02:00
parent 7870dc05ca
commit 68c26f3164
5 changed files with 110 additions and 44 deletions

View File

@@ -740,5 +740,33 @@ define([
});
};
UI.createCheckbox = function (id, label, checked) {
var inputOpts = {
type: 'checkbox',
id: id
};
if (checked) { inputOpts.checked = 'checked'; }
console.log(inputOpts);
return h('label.cp-checkmark', [
h('input', inputOpts),
h('span.cp-checkmark-mark'),
label
]);
};
UI.createRadio = function (name, id, label, checked) {
var inputOpts = {
type: 'radio',
id: id,
name: name
};
if (checked) { inputOpts.checked = 'checked'; }
return h('label.cp-radio', [
h('input', inputOpts),
h('span.cp-radio-mark'),
label
]);
};
return UI;
});