Skip to content

Commit

Permalink
clean up ctas
Browse files Browse the repository at this point in the history
  • Loading branch information
yesil committed Aug 29, 2024
1 parent 26ed3ac commit 76fb441
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libs/deps/mas/mas.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libs/deps/mas/merch-datasource.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion libs/features/mas/web-components/src/merch-datasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async function parseMerchCard(fragmentData, appendFn, merchCard, consonant) {

if (item.ctas) {
const footer = createTag('div', { slot: 'footer' }, item.ctas);
[...footer.querySelectorAll('a')].forEach((cta) => {
[...footer.querySelectorAll('strong,a')].forEach((cta) => {
if (consonant) {
cta.classList.add('con-button');
if (cta.parentElement.tagName === 'STRONG') {
Expand All @@ -122,6 +122,11 @@ async function parseMerchCard(fragmentData, appendFn, merchCard, consonant) {
footer.appendChild(spectrumCta);
}
});
[...footer.children].forEach((el) => {
if (!['STRONG', 'SP-BUTTON', 'A'].includes(el.tagName)) {
footer.removeChild(el);
}
});
appendFn(footer);
}
}
Expand Down

0 comments on commit 76fb441

Please sign in to comment.