mirror of
https://github.com/TrentSPalmer/hugo_themes_report.git
synced 2024-11-13 01:51:29 -08:00
26 lines
785 B
JavaScript
26 lines
785 B
JavaScript
function buildRadioButton(
|
|
inputID,
|
|
inputName,
|
|
inputValue,
|
|
sortedBy,
|
|
sortedBySelector,
|
|
labelText
|
|
) {
|
|
let result = document.createElement("button");
|
|
|
|
result.style.display = "flex";
|
|
result.style.alignItems = "center";
|
|
result.style.height = "2rem";
|
|
result.style.margin = ".5rem";
|
|
|
|
let inputAttsA = `id=${inputID} type="radio" name=${inputName} value=${inputValue}`;
|
|
let inputAttsB = `onclick="buildResults()" style="margin:0 1rem 0 0" class=${inputName}`;
|
|
let inputAttsC = sortedBy === sortedBySelector ? " checked" : "";
|
|
let resultButtonInput = `<input ${inputAttsA} ${inputAttsB} ${inputAttsC}/>`;
|
|
|
|
let resultButtonLabel = `<label for=${inputID}>${labelText}</label>`;
|
|
|
|
result.innerHTML = `${resultButtonInput}${resultButtonLabel}`;
|
|
return result;
|
|
}
|