Skip to content

Commit

Permalink
supplemental text and consistent variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
meganthecoder committed Apr 10, 2024
1 parent 17b1c3a commit ee76fd5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
12 changes: 8 additions & 4 deletions libs/blocks/icon-block/icon-block.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
margin-bottom: 0;
}

.icon-block.inline .body-s.action-area {
padding-top: 24px;
}

.icon-block.inline .icon-area,
.icon-block.inline .icon-area picture img {
min-width: var(--icon-size-xxl);
Expand Down Expand Up @@ -255,10 +259,6 @@
width: 100%;
}

.section[class*="-up"] .icon-block .action-area {
align-self: end;
}

.icon-block.full-width .foreground .text-content .action-area {
justify-content: center;
}
Expand Down Expand Up @@ -350,6 +350,10 @@
margin-top: var(--spacing-s);
}

.icon-block.inline .cta-container .body-s.action-area {
padding-top: 0;
}

.section[class*="-up"] .icon-block .cta-container {
display: flex;
align-items: flex-end;
Expand Down
14 changes: 6 additions & 8 deletions libs/blocks/icon-block/icon-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,14 @@ function decorateContent(el) {
if (secondColumn.children.length === 1) el.classList.add('items-center');
el.querySelector('.foreground .text-content').append(secondColumn);
}
const actionAreas = el.querySelectorAll('.action-area');
if (actionAreas.length) {
const lastActionArea = el.querySelector('.action-area:last-of-type');
if (lastActionArea) {
const div = createTag('div', { class: 'cta-container' });
const lastCta = actionAreas[actionAreas.length - 1];
const secondLastCta = actionAreas[actionAreas.length - 2];
lastCta.insertAdjacentElement('afterend', div);
if (secondLastCta && lastCta.previousElementSibling === secondLastCta) {
div.append(secondLastCta);
lastActionArea.insertAdjacentElement('afterend', div);
if (lastActionArea.previousElementSibling.className.includes('action-area')) {
div.append(lastActionArea.previousElementSibling);
}
div.append(lastCta);
div.append(lastActionArea);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions libs/blocks/media/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ export default function init(el) {
link.className = 'body-xxs';
});
}
const lastCta = el.querySelector('.action-area:last-of-type');
if (lastCta) {
const lastActionArea = el.querySelector('.action-area:last-of-type');
if (lastActionArea) {
const div = createTag('div', { class: 'cta-container' });
lastCta.insertAdjacentElement('afterend', div);
if (lastCta.previousElementSibling.className.includes('icon-stack-area')) {
div.append(lastCta.previousElementSibling);
lastActionArea.insertAdjacentElement('afterend', div);
if (lastActionArea.previousElementSibling.className.includes('icon-stack-area')) {
div.append(lastActionArea.previousElementSibling);
}
div.append(lastCta);
div.append(lastActionArea);
}
container.append(row);
});
Expand Down
9 changes: 5 additions & 4 deletions libs/blocks/text/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ export default function init(el) {
el.classList.add(...helperClasses);
decorateTextOverrides(el);
if (!hasLinkFarm) decorateMultiViewport(el);
const actionArea = el.querySelector('.action-area:last-of-type');
if (actionArea) {

const lastActionArea = el.querySelector('.action-area:last-of-type');
if (lastActionArea) {
const div = createTag('div', { class: 'cta-container' });
actionArea.insertAdjacentElement('afterend', div);
div.append(actionArea);
lastActionArea.insertAdjacentElement('afterend', div);
div.append(lastActionArea);
}
}

0 comments on commit ee76fd5

Please sign in to comment.