Skip to content

Commit

Permalink
card standard with calcite link (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
anu13297 authored Feb 6, 2025
1 parent 08f96a9 commit a6ab4a0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions eds/blocks/cards/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,21 @@ function processSimpleCard(listElem) {

function processStandardCard(element) {
const anchorEl = element.querySelector('a');
const calciteLinkEl = element.querySelector('calcite-link');
const cardBodyContent = domEl('div', { class: 'card-body-content' });

const appendCardBodyContent = (parent) => {
parent.replaceChildren(cardBodyContent);
element.append(parent);
};

if (anchorEl) {
anchorEl.replaceChildren(cardBodyContent);
element.append(anchorEl);
appendCardBodyContent(anchorEl);
} else if (calciteLinkEl) {
const newAnchorEl = document.createElement('a');
newAnchorEl.setAttribute('href', calciteLinkEl.getAttribute('href'));
appendCardBodyContent(newAnchorEl);
calciteLinkEl.remove();
} else {
element.append(cardBodyContent);
}
Expand Down

0 comments on commit a6ab4a0

Please sign in to comment.