Skip to content

Commit

Permalink
refactoring: Remove pillar show/hide areas option
Browse files Browse the repository at this point in the history
  • Loading branch information
martintomas committed Nov 27, 2023
1 parent 6ae3c1c commit ce3da15
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
4 changes: 0 additions & 4 deletions app/assets/stylesheets/tpi/pages/ascor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,6 @@ $see-more-width-tablet: 130px;
}
}

&__areas {
display: none;
}

&__area {
outline: solid 1px $grey-lighter-medium;
padding: 15px 20px 30px 20px;
Expand Down
26 changes: 2 additions & 24 deletions app/javascript/components/tpi/AscorQuestionLegend.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import React, { useState, useEffect } from 'react';
import cx from 'classnames';
import React, { useEffect } from 'react';

const AscorQuestionLegend = () => {
const [isVisible, setVisible] = useState(false);

const isCheckedArea = () => {
let anyChecked = false;

Expand All @@ -22,16 +19,6 @@ const AscorQuestionLegend = () => {
});
};

const isCheckedPillar = () => {
let anyChecked = false;

document.querySelectorAll('.country-assessment > input.toggle.pillar').forEach((input) => {
anyChecked = anyChecked || input.checked;
});

setVisible(anyChecked);
};

useEffect(() => {
const eventListeners = [];
document
Expand All @@ -43,15 +30,6 @@ const AscorQuestionLegend = () => {
eventListeners.push([input, listener]);
});

document
.querySelectorAll(
'.country-assessment > input.toggle.pillar'
)
.forEach((input) => {
const listener = input.addEventListener('click', isCheckedPillar);
eventListeners.push([input, listener]);
});

return () => {
eventListeners.forEach(([input, listener]) => {
input.removeEventListener('click', listener);
Expand All @@ -60,7 +38,7 @@ const AscorQuestionLegend = () => {
});

return (
<div className={cx('banking-question-legend', { 'banking-question-legend--active': isVisible })}>
<div className="banking-question-legend banking-question-legend--active">
<div className="banking-question-legend__header">Legend</div>
<div className="country-question-legend__content">
<div className="country-question-legend-answer country-question-legend-answer--no">
Expand Down
1 change: 0 additions & 1 deletion app/views/tpi/ascor/_assessment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<div class="country-assessment__pillar__header">
<div class="country-assessment__pillar__subtitle"><%= "Pillar #{i + 1}" %></div>
<h2 class="country-assessment__pillar__title"><%= pillar.text %></h2>
<label class="country-assessment__more pillar" for="pillar-<%= dom_id(pillar) %>"></label>
</div>

<div class="country-assessment__areas" for="pillar-<%= dom_id(pillar) %>">
Expand Down

0 comments on commit ce3da15

Please sign in to comment.