mirror of
https://github.com/TrentSPalmer/hugo_themes_report.git
synced 2025-11-21 02:08:25 -08:00
add buttons over checks and radios
This commit is contained in:
@@ -1,53 +1,56 @@
|
||||
function buildSortByDiv(sortedBy) {
|
||||
let menuDiv = document.getElementById('selection-menu');
|
||||
menuDiv.innerHTML = '';
|
||||
menuDiv.style.maxWidth = '100%';
|
||||
let menuDiv = document.getElementById("selection-menu");
|
||||
menuDiv.innerHTML = "";
|
||||
menuDiv.style.maxWidth = "100%";
|
||||
|
||||
let sortByRow = document.createElement('div');
|
||||
sortByRow.id = 'sortByRow';
|
||||
sortByRow.style.width = '500px';
|
||||
sortByRow.style.maxWidth = '100%';
|
||||
sortByRow.style.display = 'flex';
|
||||
sortByRow.style.justifyContent = 'space-around';
|
||||
sortByRow.style.margin = '1rem auto 1rem auto';
|
||||
let sortByRow = document.createElement("div");
|
||||
sortByRow.id = "sortByRow";
|
||||
sortByRow.style.width = "500px";
|
||||
sortByRow.style.maxWidth = "100%";
|
||||
sortByRow.style.display = "flex";
|
||||
sortByRow.style.justifyContent = "space-around";
|
||||
sortByRow.style.margin = "1rem auto 1rem auto";
|
||||
|
||||
let sortByPrompt = document.createElement('div');
|
||||
let sortByPrompt = document.createElement("div");
|
||||
sortByPrompt.style.display = "flex";
|
||||
sortByPrompt.style.alignItems = "center";
|
||||
sortByPrompt.innerHTML = "Sort By:";
|
||||
sortByRow.appendChild(sortByPrompt);
|
||||
|
||||
let sortByStarsDiv = document.createElement('div');
|
||||
let sortByStarsInput = document.createElement('input');
|
||||
sortByStarsInput.type = 'radio';
|
||||
sortByStarsInput.id = 'sortByStars';
|
||||
sortByStarsInput.name = 'sortBy';
|
||||
sortByStarsInput.value = 'stars';
|
||||
sortByStarsInput.checked = sortedBy === 'stars' ? true : false;
|
||||
sortByStarsInput.onclick = function() { buildResults(); };
|
||||
sortByStarsDiv.appendChild(sortByStarsInput);
|
||||
let sortByStarsButton = buildRadioButton(
|
||||
(inputID = "sortByStars"),
|
||||
(inputName = "sortBy"),
|
||||
(inputValue = "stars"),
|
||||
(sortedBy = sortedBy),
|
||||
(sortedBySelector = "stars"),
|
||||
(labelText = "Stars")
|
||||
);
|
||||
|
||||
let sortByStarsLabel = document.createElement('label');
|
||||
sortByStarsLabel.for = 'stars';
|
||||
sortByStarsLabel.innerHTML = 'Stars';
|
||||
sortByStarsDiv.appendChild(sortByStarsLabel);
|
||||
|
||||
let sortByLastCommitDiv = document.createElement('div');
|
||||
let sortByLastCommitInput = document.createElement('input');
|
||||
sortByLastCommitInput.type = 'radio';
|
||||
sortByLastCommitInput.id = 'sortByDate';
|
||||
sortByLastCommitInput.name = 'sortBy';
|
||||
sortByLastCommitInput.value = 'date';
|
||||
sortByLastCommitInput.checked = sortedBy === 'date' ? true : false;
|
||||
sortByLastCommitInput.onclick = function() { buildResults(); };
|
||||
sortByLastCommitDiv.appendChild(sortByLastCommitInput);
|
||||
|
||||
let sortByLastCommitLabel = document.createElement('label');
|
||||
sortByLastCommitLabel.for = 'date';
|
||||
sortByLastCommitLabel.innerHTML = 'Latest Commit Date';
|
||||
sortByLastCommitDiv.appendChild(sortByLastCommitLabel);
|
||||
|
||||
|
||||
sortByRow.appendChild(sortByStarsDiv);
|
||||
sortByRow.appendChild(sortByLastCommitDiv);
|
||||
let sortByLastCommitButton = buildRadioButton(
|
||||
(inputID = "sortByDate"),
|
||||
(inputName = "sortBy"),
|
||||
(inputValue = "date"),
|
||||
(sortedBy = sortedBy),
|
||||
(sortedBySelector = "date"),
|
||||
(labelText = "Latest Commit Date")
|
||||
);
|
||||
|
||||
sortByRow.appendChild(sortByStarsButton);
|
||||
sortByRow.appendChild(sortByLastCommitButton);
|
||||
menuDiv.appendChild(sortByRow);
|
||||
|
||||
let sortByStarsInput = document.getElementById("sortByStars");
|
||||
sortByStarsButton.onclick = function () {
|
||||
if (!sortByStarsInput.checked) {
|
||||
sortByStarsInput.checked = true;
|
||||
buildResults();
|
||||
}
|
||||
};
|
||||
let sortByLastCommitInput = document.getElementById("sortByDate");
|
||||
sortByLastCommitButton.onclick = function () {
|
||||
if (!sortByLastCommitInput.checked) {
|
||||
sortByLastCommitInput.checked = true;
|
||||
buildResults();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user