mirror of
https://github.com/TrentSPalmer/hugo_themes_report.git
synced 2024-12-04 16:41:31 -08:00
add color highlights for tags
This commit is contained in:
parent
afbe353ca9
commit
d03c4b5ef9
@ -149,7 +149,10 @@ function buildResults() {
|
||||
selectedLicenses
|
||||
);
|
||||
sortThemes(filteredThemes, sortedBy);
|
||||
filteredThemes.forEach((theme) => addThemeTableRow(theme, selectedColumns));
|
||||
// from buildThemeTableRow.js
|
||||
filteredThemes.forEach((theme) =>
|
||||
addThemeTableRow(theme, selectedColumns, selectedTags)
|
||||
);
|
||||
|
||||
// from buildSelectionMenu.js
|
||||
buildSelectionMenu(
|
||||
|
@ -1,4 +1,4 @@
|
||||
function addThemeTableRow(theme, selectedColumns) {
|
||||
function addThemeTableRow(theme, selectedColumns, selectedTags) {
|
||||
let resultsTable = document.getElementById("resultsTable");
|
||||
let resultsTableRow = document.createElement("tr");
|
||||
|
||||
@ -53,7 +53,13 @@ function addThemeTableRow(theme, selectedColumns) {
|
||||
let tagsTD = document.createElement("td");
|
||||
let tL = theme.tags.length - 1;
|
||||
tL += theme.tags.map((x) => x.length).reduce((a, b) => a + b, 0);
|
||||
tagsTD.innerHTML = theme.tags;
|
||||
let sTags = theme.tags.filter((x) => selectedTags.includes(x));
|
||||
let nsTags = theme.tags.filter((x) => !selectedTags.includes(x));
|
||||
if (sTags.length > 0 && nsTags.length > 0) {
|
||||
tagsTD.innerHTML = `<span style="color: green">${sTags}</span>,${nsTags}`;
|
||||
} else {
|
||||
tagsTD.innerHTML = `<span style="color: green">${sTags}</span>${nsTags}`;
|
||||
}
|
||||
tagsTD.style.minWidth = `${tL / 7}rem`;
|
||||
resultsTableRow.appendChild(tagsTD);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user