Skip to content

Commit

Permalink
refactored nested ternary opeartion for lint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
anu13297 committed Jan 15, 2025
1 parent f95067c commit 7f67f3b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions eds/blocks/cards/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,14 @@ export default function decorate(block) {
const pTags = element.querySelectorAll('p');
titleSelector = (pTags.length >= 3) ? 'p:nth-last-child(2)' : 'p:nth-last-child(1)';
} else if (!block.classList.contains('simple') && !block.classList.contains('standard')) {
titleSelector = (linksCount === 1) ? 'p:nth-last-child(3)' :
(linksCount === 2) ? 'p:nth-last-child(4)' : 'p:nth-last-child(3)';
}
if (linksCount === 1) {
titleSelector = 'p:nth-last-child(3)';
} else if (linksCount === 2) {
titleSelector = 'p:nth-last-child(4)';
} else {
titleSelector = 'p:nth-last-child(3)';
}
}
if (titleSelector) {
element.querySelectorAll(titleSelector).forEach((p) => {
const h3 = document.createElement('h3');
Expand Down

0 comments on commit 7f67f3b

Please sign in to comment.