generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mwpw-142267: Merch What's Included and Merch Mnemonic List (TwP) (#2554)
* MWPW-142267: What's Included screen (TwP) * Update merch-whats-included.css * Update merch-whats-included.css * Update merch-whats-included.css * updated libs from main * Update merch-whats-included.js * updated deps * address review comments. 'HEAD' branch instead of main because I had to reset to Axels commit to avoid 'callout' change * Update merch-whats-included.css * Update merch-whats-included.css * Update merch-whats-included.css * Update merch-whats-included.css * Update merch-whats-included.css * style fixes * updated deps * h3 styles * responsive width * Update merch-whats-included.css * removed event listener * unit tests --------- Co-authored-by: Mariia Lukianets <mariia.lukianets@gmail.com>
- Loading branch information
1 parent
f160c4d
commit d932b35
Showing
11 changed files
with
355 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.merch-mnemonic-list { | ||
display: flex; | ||
height: 380px; | ||
flex-flow: column; | ||
flex-wrap: wrap; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import '../../deps/merch-mnemonic-list.js'; | ||
import '../../deps/merch-card.js'; | ||
import { createTag } from '../../utils/utils.js'; | ||
|
||
const init = async (el) => { | ||
const rows = el.querySelectorAll(':scope p:not([class])'); | ||
if (rows.length < 1) return; | ||
[...rows].forEach((paragraph) => { | ||
const merchMnemonicList = createTag('merch-mnemonic-list'); | ||
paragraph.setAttribute('slot', 'description'); | ||
const picture = paragraph.querySelector('picture'); | ||
const img = picture.querySelector('img'); | ||
const icon = createTag('merch-icon', { slot: 'icon', size: 's', src: img.src }); | ||
picture.remove(); | ||
if (icon) merchMnemonicList.appendChild(icon); | ||
if (paragraph) merchMnemonicList.appendChild(paragraph); | ||
el.appendChild(merchMnemonicList); | ||
}); | ||
}; | ||
|
||
export default init; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.merch-whats-included-container > .fragment { | ||
width: inherit; | ||
height: inherit; | ||
max-height: 100%; | ||
display: block; | ||
} | ||
|
||
.merch-whats-included-container .content h3 { | ||
margin: 0; | ||
} | ||
|
||
.merch-whats-included-container .fragment .container { | ||
display: contents; | ||
} | ||
|
||
.merch-whats-included-container .fragment .content { | ||
float: right; | ||
} | ||
|
||
.merch-whats-included-container .fragment .content a[is="checkout-link"] { | ||
margin-inline-start: var(--spacing-xxs); | ||
} | ||
|
||
@media screen and (max-width: 767px) { | ||
.merch-whats-included-container { | ||
position: fixed; | ||
overflow: hidden scroll; | ||
} | ||
|
||
.merch-mnemonic-list { | ||
height: auto; | ||
} | ||
|
||
.merch-whats-included-container .fragment .container { | ||
grid-auto-flow: row; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import '../../deps/merch-whats-included.js'; | ||
import { createTag } from '../../utils/utils.js'; | ||
|
||
const init = async (el) => { | ||
const styles = Array.from(el.classList); | ||
const mobileRows = styles.find((style) => /\d/.test(style)); | ||
const heading = el.querySelector('h3, h4'); | ||
const content = el.querySelector('.section'); | ||
|
||
const contentSlot = createTag( | ||
'div', | ||
{ slot: 'content' }, | ||
content.innerHTML, | ||
); | ||
const whatsIncluded = createTag( | ||
'merch-whats-included', | ||
{ mobileRows: mobileRows || 1 }, | ||
); | ||
if (heading) { | ||
heading.setAttribute('slot', 'heading'); | ||
whatsIncluded.appendChild(heading); | ||
} | ||
|
||
whatsIncluded.appendChild(contentSlot); | ||
const divsWithoutClass = contentSlot.querySelectorAll('div:not([class])'); | ||
divsWithoutClass.forEach((div) => div.remove()); | ||
el.replaceWith(whatsIncluded); | ||
}; | ||
|
||
export default init; |
Oops, something went wrong.