Skip to content

Commit f7dac24

Browse files
#1067: Overwrite MoM classnames instead of adding to the list (#1069)
* overwrite classnames instead of adding to them * Fix bug from #1068 --------- Co-authored-by: Barry Pollard <barrypollard@google.com>
1 parent fbd5289 commit f7dac24

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/js/techreport/summaryCards.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ class SummaryCard {
7373
});
7474
}
7575

76-
if(latestChange && latestChange.string && latestChange.perc) {
76+
if(latestChange && latestChange.string && latestChange.perc != null) {
7777
const changeSlot = card.querySelector('[data-slot="change"]');
7878
const changeMeaning = changeSlot?.dataset?.meaning;
7979

8080
if(changeSlot) {
8181
changeSlot.textContent = latestChange.string;
8282
const styling = UIUtils.getChangeStatus(latestChange.perc, changeMeaning);
83-
changeSlot.classList.add(styling?.color, styling?.direction);
83+
changeSlot.className = `monthchange ${styling?.color} ${styling?.direction}`;
8484
}
8585
}
8686
}

src/js/techreport/table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function updateTable(id, config, appConfig, apps, data) {
194194
}
195195

196196
if(column.styling) {
197-
wrapper.classList.add('monthchange', column.styling?.direction, column.styling?.color);
197+
wrapper.className = `monthchange ${column?.styling?.color} ${column?.styling?.direction}`;
198198
}
199199

200200
// Add cell to the row

src/js/techreport/timeseries.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class Timeseries {
175175
const styling = UIUtils.getChangeStatus(latestMoM, changeMeaning);
176176
const monthChange = document.createElement('span');
177177
monthChange.textContent = latestMoMStr;
178-
monthChange.classList.add('monthchange', styling?.color, styling.direction);
178+
monthChange.className = `monthchange ${styling?.color} ${styling?.direction}`;
179179
itemWrapper.appendChild(monthChange);
180180
}
181181

@@ -250,7 +250,7 @@ class Timeseries {
250250
const styling = UIUtils.getChangeStatus(latestMoM, changeMeaning);
251251
const monthChange = document.createElement('span');
252252
monthChange.textContent = latestMoMStr;
253-
monthChange.classList.add('monthchange', styling?.color, styling.direction);
253+
monthChange.className = `monthchange ${styling?.color} ${styling?.direction}`;
254254
card.appendChild(monthChange);
255255
}
256256
}

0 commit comments

Comments
 (0)