Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Added alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
redvelvet511 committed Aug 17, 2023
1 parent 1cd2c9f commit c042bfa
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 9 deletions.
25 changes: 18 additions & 7 deletions express/blocks/puf/puf.css
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,10 @@ main .block.puf .puf-card .puf-card-bottom {
main .block.puf .puf-card .puf-card-bottom h3 {
font-size: var(--body-font-size-xl);
font-weight: 600;
padding: 16px;
margin-bottom: 24px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20px;
}

main .block.puf .puf-card .puf-card-bottom p {
Expand Down Expand Up @@ -250,6 +252,7 @@ main .block.puf .puf-highlighted-text {
border-radius: 12px;
margin-top: 0;
box-sizing: border-box;
padding: 10px;
}

main .block.puf .puf-pricing-footer {
Expand Down Expand Up @@ -299,7 +302,6 @@ main .block.puf .puf-card .puf-card-banner {
border-radius: 20px 20px 0 0;
}


@media (min-width: 900px) {
main .puf.block .carousel-container {
max-width: none;
Expand Down Expand Up @@ -332,7 +334,10 @@ main .block.puf .puf-card .puf-card-banner {
margin-top: -14px;
}

main .block.puf .carousel-container:has(+ .puf-pricing-footer) .carousel-platform {
main
.block.puf
.carousel-container:has(+ .puf-pricing-footer)
.carousel-platform {
padding-bottom: 24px;
}

Expand Down Expand Up @@ -498,9 +503,15 @@ main .block.puf .puf-card .puf-card-banner {
box-shadow: 0px 0px 20px #00000029;
}

main .block.puf .puf-card-banner.recommended ~ .puf-card-bottom .puf-highlighted-text {
margin-bottom: 40px;
}
main
.block.puf
.puf-card-banner.recommended
~ .puf-card-bottom
.puf-highlighted-text {
display: flex;
align-items: center;
justify-content: center;
}

main
.block.puf
Expand Down
64 changes: 62 additions & 2 deletions express/blocks/puf/puf.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,64 @@ function highlightText($block) {
});
}

function alignP($block) {
const cardLeftQuery = '.puf-card.puf-left > .puf-card-top > p:last-of-type';
const cardRightQuery = '.puf-card.puf-right > .puf-card-top > p:last-of-type';

const card1 = $block.querySelector(cardLeftQuery);
const card2 = $block.querySelector(cardRightQuery);

const adjustHeight = () => {
card1.style.height = 'auto';

Check failure on line 453 in express/blocks/puf/puf.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Expected indentation of 4 spaces but found 6
card2.style.height = 'auto';

Check failure on line 454 in express/blocks/puf/puf.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Expected indentation of 4 spaces but found 6

const maxHeight = Math.max(

Check failure on line 456 in express/blocks/puf/puf.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Expected indentation of 4 spaces but found 6
card1.getBoundingClientRect().height,

Check failure on line 457 in express/blocks/puf/puf.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Expected indentation of 6 spaces but found 10
card2.getBoundingClientRect().height,

Check failure on line 458 in express/blocks/puf/puf.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Expected indentation of 6 spaces but found 10
);

Check failure on line 459 in express/blocks/puf/puf.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Expected indentation of 4 spaces but found 6

card1.style.height = `${maxHeight}px`;

Check failure on line 461 in express/blocks/puf/puf.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Expected indentation of 4 spaces but found 6
card2.style.height = `${maxHeight}px`;

Check failure on line 462 in express/blocks/puf/puf.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Expected indentation of 4 spaces but found 6
};

const ro = new ResizeObserver(() => adjustHeight());

ro.observe(card1);
ro.observe(card2);

adjustHeight();
}

function alignHighlights($block) {
const cardLeftTitle = '.puf-card.puf-left > .puf-card-bottom > h3';
const cardRightTitle= '.puf-card.puf-right > .puf-card-bottom > h3';

Check failure on line 475 in express/blocks/puf/puf.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Operator '=' must be spaced

const cardLeft = $block.querySelector(cardLeftTitle);
const cardRight= $block.querySelector(cardRightTitle);

Check failure on line 478 in express/blocks/puf/puf.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Operator '=' must be spaced

const adjustHeight = () => {
cardLeft.style.height = 'auto';
cardRight.style.height = 'auto';

const maxHeightTitle = Math.max(
cardLeft.getBoundingClientRect().height,
cardRight.getBoundingClientRect().height
);


cardLeft.style.height = `${maxHeightTitle}px`;
cardRight.style.height = `${maxHeightTitle}px`;
};

const ro = new ResizeObserver(() => adjustHeight());

ro.observe(cardLeft);
ro.observe(cardRight);

adjustHeight();
}


function decorateFooter($block) {
if ($block?.children?.[3]) {
const $footer = createTag('div', { class: 'puf-pricing-footer' });
Expand All @@ -464,7 +522,9 @@ export default function decorate($block) {
updatePUFCarousel($block);
addPublishDependencies('/express/system/offers-new.json');
wrapTextAndSup($block);

$block.append($footer);
alignP($block);
highlightText($block);
alignHighlights($block);

$block.append($footer);
}

0 comments on commit c042bfa

Please sign in to comment.