diff --git a/app/javascript/components/tpi/AscorQuestionLegend.js b/app/javascript/components/tpi/AscorQuestionLegend.js index cfae07a62..c814e65f4 100644 --- a/app/javascript/components/tpi/AscorQuestionLegend.js +++ b/app/javascript/components/tpi/AscorQuestionLegend.js @@ -7,25 +7,33 @@ const AscorQuestionLegend = () => { const isChecked = () => { let anyChecked = false; - document.querySelectorAll('.country-assessment > .country-assessment__pillar').forEach((section) => { - let areaChecked = false; + document + .querySelectorAll('.country-assessment > .country-assessment__pillar') + .forEach((section) => { + let areaChecked = false; - section.querySelectorAll('input.toggle').forEach((input) => { - areaChecked = areaChecked || input.checked; - anyChecked = anyChecked || input.checked; + section.querySelectorAll('input.toggle').forEach((input) => { + areaChecked = areaChecked || input.checked; + anyChecked = anyChecked || input.checked; + }); + return areaChecked + ? section.classList.add('active') + : section.classList.remove('active'); }); - return areaChecked ? section.classList.add('active') : section.classList.remove('active'); - }); setVisible(anyChecked); }; useEffect(() => { const eventListeners = []; - document.querySelectorAll('.country-assessment > .country-assessment__pillar > input.toggle').forEach((input) => { - const listener = input.addEventListener('click', isChecked); - eventListeners.push([input, listener]); - }); + document + .querySelectorAll( + '.country-assessment > .country-assessment__pillar > input.toggle' + ) + .forEach((input) => { + const listener = input.addEventListener('click', isChecked); + eventListeners.push([input, listener]); + }); return () => { eventListeners.forEach(([input, listener]) => { @@ -35,10 +43,12 @@ const AscorQuestionLegend = () => { }); return ( -
At ASCOR, we are here to help and answer any questions you may have. Contact us at gri.ascor@lse.ac.uk.
Contact ASCOR