Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release] Stage to Main #2203

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions libs/blocks/icon-block/icon-block.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@
.icon-block .foreground {
position: relative;
text-align: center;
width: 100%;
}

.icon-block .foreground .text-content {
display: flex;
flex-wrap: wrap;
flex-direction: column;
align-content: center;
width: 100%;
}
Expand Down Expand Up @@ -167,6 +168,11 @@
margin: var(--spacing-s) auto var(--spacing-xs) auto;
}

.section[class*="-up"] .icon-block .second-column {
display: flex;
flex-direction: column;
}

.icon-block.bio.center .foreground .second-column {
margin-top: var(--spacing-s);
}
Expand Down Expand Up @@ -246,10 +252,18 @@
margin-bottom: var(--spacing-s);
}

.icon-block.bio .cta-container {
margin-top: 0;
}

.icon-block .foreground .text-content p.body-m.action-area {
margin-bottom: 0;
}

.icon-block .cta-container .action-area {
width: 100%;
}

.icon-block.full-width .foreground .text-content .action-area {
justify-content: center;
}
Expand Down Expand Up @@ -298,6 +312,11 @@
margin: unset;
}

.section[class*="-up"] .icon-block .foreground {
display: flex;
align-self: stretch;
}

[class*="-up"] .icon-block.bio.inline .foreground {
max-width: unset;
width: unset;
Expand Down Expand Up @@ -326,6 +345,27 @@
line-height: var(--type-body-m-lh);
}

.section[class*="-up"] .icon-block {
display: flex;
align-self: stretch;
}

.icon-block .cta-container {
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;
justify-content: flex-end;
flex-direction: column;
width: 100%;
}

@media screen and (min-width: 600px) and (max-width: 1200px) {
.icon-block .foreground .icon-area {
max-width: 234px;
Expand Down Expand Up @@ -428,8 +468,6 @@
}

.icon-block.vertical .foreground .text-content {
flex-grow: 1;
flex-basis: 0;
margin-bottom: 0;
}

Expand Down
9 changes: 9 additions & 0 deletions libs/blocks/icon-block/icon-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ function decorateContent(el) {
if (secondColumn.children.length === 1) el.classList.add('items-center');
el.querySelector('.foreground .text-content').append(secondColumn);
}
const lastActionArea = el.querySelector('.action-area:last-of-type');
if (lastActionArea) {
const div = createTag('div', { class: 'cta-container' });
lastActionArea.insertAdjacentElement('afterend', div);
if (lastActionArea.previousElementSibling.className.includes('action-area')) {
div.append(lastActionArea.previousElementSibling);
}
div.append(lastActionArea);
}
}
}

Expand Down
48 changes: 48 additions & 0 deletions libs/blocks/media/media.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
display: flex;
gap: var(--spacing-s);
align-items: flex-start;
width: 100%;
}

.media .text .icon-area {
Expand Down Expand Up @@ -254,6 +255,49 @@ div[class*="-up"] .media .foreground > .media-row {
height: var(--icon-size-xxl);
}

/* Text Alignment */
.section[class*="-up"] .media:not(.media-reverse-mobile, .qr-code) {
display: flex;
align-self: stretch;
}

.section[class*="-up"] .media:not(.media-reverse-mobile, .qr-code) .foreground {
display: flex;
align-self: stretch;
width: 100%
}

.section[class*="-up"] .media:not(.media-reverse-mobile, .qr-code) .foreground > div.media-row {
display: flex;
flex-direction: column;
width: 100%;
}

.section[class*="-up"] .media:not(.media-reverse-mobile, .qr-code) .foreground .text {
display: flex;
flex-direction: column;
height: 100%;
}

.section[class*="-up"] .media:not(.media-reverse-mobile, .qr-code) [class*="heading-"],
.section[class*="-up"] .media:not(.media-reverse-mobile, .qr-code) p:not([class*="detail-"]):not(.subcopy-link),
.section[class*="-up"] .media:not(.media-reverse-mobile, .qr-code) [class*="body-"] {
margin-bottom: 0;
}

.section[class*="-up"] .media.merch.bio:not(.media-reverse-mobile, .qr-code) [class*="body-"]:first-child:not(.action-area, .icon-stack-area) {
margin-top: 0;
margin-bottom: revert;
}

.section[class*="-up"] .media:not(.media-reverse-mobile, .qr-code) .cta-container {
display: flex;
flex-direction: column;
justify-content: flex-end;
width: 100%;
height: 100%;
}

@media screen and (min-width: 600px) {
.media > .foreground .media-row {
gap: var(--spacing-m);
Expand Down Expand Up @@ -318,6 +362,10 @@ div[class*="-up"] .media .foreground > .media-row {
.media .icon-stack-area {
grid-template-columns: repeat(2, 1fr);
}

.section[class*="-up"] .media:not(.media-reverse-mobile) .foreground > div.media-row {
gap: 0;
}
}

@media screen and (min-width: 1200px) {
Expand Down
9 changes: 9 additions & 0 deletions libs/blocks/media/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ export default function init(el) {
link.className = 'body-xxs';
});
}
const lastActionArea = el.querySelector('.action-area:last-of-type');
if (lastActionArea) {
const div = createTag('div', { class: 'cta-container' });
lastActionArea.insertAdjacentElement('afterend', div);
if (lastActionArea.previousElementSibling.className.includes('icon-stack-area')) {
div.append(lastActionArea.previousElementSibling);
}
div.append(lastActionArea);
}
container.append(row);
});

Expand Down
37 changes: 36 additions & 1 deletion libs/blocks/text/text.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

.text-block [class^="detail"] { margin: 0 0 var(--spacing-xxs) 0; }

.text-block .cta-container,
.text-block p.action-area { margin-top: var(--spacing-s); }

.text-block div > *:last-child { margin-bottom: 0; }
Expand Down Expand Up @@ -62,6 +63,10 @@
align-items: center;
}

.text-block .cta-container .action-area {
width: 100%;
}

.text-block hr {
border-color: #e1e1e1;
border-style: solid;
Expand Down Expand Up @@ -191,9 +196,39 @@
display: none;
}

/* Text Alignment */
.section[class*="-up"] .text-block:not(.legal, .link-farm) {
display: flex;
align-self: stretch;
}

.section[class*="-up"] .text-block:not(.legal, .link-farm) .foreground {
display: flex;
align-self: stretch;
width: 100%;
}

.section[class*="-up"] .text-block:not(.legal, .link-farm) .foreground > div {
display: flex;
flex-direction: column;
width: 100%;
}

.section[class*="-up"] .text-block:not(.legal, .link-farm) [class^="heading"],
.section[class*="-up"] .text-block:not(.legal, .link-farm) p:not([class^="detail-"]),
.section[class*="-up"] .text-block:not(.legal, .link-farm) [class^="body-"] {
margin-bottom: 0;
}

.section[class*="-up"] .text-block:not(.legal, .link-farm) .cta-container {
display: flex;
align-items: flex-end;
width: 100%;
height: 100%;
}

/* Tablet up */
@media screen and (min-width: 600px) {

.inset.text-block .foreground::before {
display: none;
}
Expand Down
7 changes: 7 additions & 0 deletions libs/blocks/text/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,11 @@ export default function init(el) {
el.classList.add(...helperClasses);
decorateTextOverrides(el);
if (!hasLinkFarm) decorateMultiViewport(el);

const lastActionArea = el.querySelector('.action-area:last-of-type');
if (lastActionArea) {
const div = createTag('div', { class: 'cta-container' });
lastActionArea.insertAdjacentElement('afterend', div);
div.append(lastActionArea);
}
}
10 changes: 10 additions & 0 deletions test/blocks/icon-block/icon-block.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,14 @@ describe('icon blocks', () => {
expect(heading).to.not.exist;
});
});
describe('cta container', () => {
it('is added around the only action area', () => {
expect(document.querySelector('.cta-container #one-cta')).to.exist;
});
it('is added around adjacent action areas', () => {
const parent = document.querySelector('#adjacent-cta-1').parentElement;
expect(parent.className.includes('cta-container')).to.be.true;
expect(parent.querySelector('#adjacent-cta-2')).to.exist;
});
});
});
6 changes: 3 additions & 3 deletions test/blocks/icon-block/mocks/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ <h3 id="heading-xl-bold-icon-block">Heading XL Bold Icon Block</h3>
</p>
<h2 id="heading-l-bold-icon-block-1">Heading L Bold Icon Block</h2>
<p>Body M Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.</p>
<p><em><a href="https://www.adobe.com/"><strong>Learn more</strong></a></em></p>
<p><a href="https://www.adobe.com/">Body M BOLD Text link</a></p>
<p id="adjacent-cta-1"><em><a href="https://www.adobe.com/"><strong>Learn more</strong></a></em></p>
<p id="adjacent-cta-2"><a href="https://www.adobe.com/">Body M BOLD Text link</a></p>
</div>
</div>
</div>
Expand All @@ -42,7 +42,7 @@ <h2 id="heading-l-bold-icon-block-1">Heading L Bold Icon Block</h2>
</p>
<h2 id="heading-m-bold-2-up-lorem-ipsum-sit-amet">Heading M Bold 2-up Lorem ipsum sit amet</h2>
<p>Body M Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.</p>
<p><em><a href="https://www.adobe.com/"><strong>Learn more</strong></a></em> <a href="https://www.adobe.com/">Body XS Text link</a></p>
<p id="one-cta"><em><a href="https://www.adobe.com/"><strong>Learn more</strong></a></em> <a href="https://www.adobe.com/">Body XS Text link</a></p>
</div>
</div>
</div>
Expand Down
15 changes: 15 additions & 0 deletions test/blocks/media/media.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ describe('media', () => {
const blueButton = actionArea.querySelector('.con-button.blue');
expect(blueButton).to.exist;
});
it('has a cta container', () => {
const ctaArea = medias[0].querySelector('.cta-container .action-area');
expect(ctaArea).to.exist;
});
});
describe('dark media large', () => {
it('has a heading-xl', () => {
Expand All @@ -54,6 +58,10 @@ describe('media', () => {
const links = medias[4].querySelectorAll('h3.heading-xs ~ p.subcopy-link > a');
expect(links.length).to.greaterThanOrEqual(2);
});
it('does not have cta container around mid-body action area', () => {
const actionArea = medias[4].querySelector('.action-area');
expect(actionArea.parentElement.className.includes('cta-container')).to.be.false;
});
});
describe('media with qr-code', () => {
it('does have qr-code image', () => {
Expand Down Expand Up @@ -104,4 +112,11 @@ describe('media', () => {
expect(iconStack).to.exist;
});
});
describe('with merch variant', () => {
it('has a cta container around the icon stack and action area', () => {
const cta = medias[7].querySelector('.cta-container');
expect(cta.querySelector('.icon-stack-area')).to.exist;
expect(cta.querySelector('.action-area')).to.exist;
});
});
});
29 changes: 29 additions & 0 deletions test/blocks/media/mocks/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,33 @@ <h2 id="heading-m-2430-media">Heading M 24/30 Media</h2>
</div>
</div>
</div>
<div class="media merch small">
<div>
<div data-valign="middle">
<picture>
<img src="">
</picture>
</div>
<div data-valign="middle">
<p><strong>Detail M 12/15</strong></p>
<h2 id="heading-xs-1822-media-merch-small"><strong>Heading XS 18/22 Media (merch, small)</strong></h2>
<p>Body S 16/24 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat. Lorem ipsum dolor sit amet, consetetur sadipscing elitr.</p>
<ul>
<li>
<picture>
<source media="(max-width: 400px)" srcset="./">
<img alt="mock" loading="lazy" src="">
</picture> <a href="https://www.adobe.com">Adobe Photoshop</a>
</li>
<li>
<picture>
<source media="(max-width: 400px)" srcset="./">
<img alt="mock" loading="lazy" src="">
</picture><a href="">Adobe Illustrator</a>
</li>
</ul>
<p><strong><a href="https://adobe.com/">Learn More</a></strong> <em><a href="https://adobe.com/">Watch the Video</a></em></p>
</div>
</div>
</div>

12 changes: 12 additions & 0 deletions test/blocks/text/mocks/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,15 @@ <h2 id="text--full-width-large">Tablet, Desktop</h2>
</div>
</div>
</div>

<div class="text">
<div>
<div>
<h3 id="text">Text</h3>
<p>Section Metadata - Two-Up</p>
<p id="no-container"><em><a href="#learn">Learn about</a></em></p>
<p>Kick things off with hundreds of premium and free presets you can access with your Lightroom subscription.</p>
<p id="has-container"><em><a href="#learn">Learn about</a></em> <a href="#link">Body XS 14/21 Text link</a></p>
</div>
</div>
</div>
Loading
Loading