-
Notifications
You must be signed in to change notification settings - Fork 177
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
Mwpw-142267: Merch What's Included and Merch Mnemonic List (TwP) #2554
Changes from 4 commits
893a099
954105d
6f6a0af
024f2b8
46fe52c
a178fa6
1cbc547
5ea4544
ca1f4fb
3cbb527
afab6ee
57abb1b
8815dbc
29e3cf1
93280ae
82a00b2
e7f2fb1
ed12ec8
df184c9
4a53741
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.merch-mnemonic-list { | ||
display: contents; | ||
} |
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; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.merch-whats-included-container > .fragment { | ||
width: inherit; | ||
height: inherit; | ||
} | ||
|
||
.merch-whats-included-container .fragment .container { | ||
display: grid; | ||
grid-auto-flow: column; | ||
width: auto; | ||
} | ||
|
||
@media screen and (max-width: 767px) { | ||
.merch-whats-included-container { | ||
position: fixed; | ||
overflow: hidden scroll; | ||
} | ||
|
||
.merch-whats-included-container .fragment .container { | ||
grid-auto-flow: row; | ||
} | ||
} |
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; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// branch: MWPW-142267 commit: db56fa6d1f49aa580f3da94842ffb9e73516ee18 Mon, 08 Jul 2024 21:06:50 GMT | ||
Check warning on line 1 in libs/deps/merch-mnemonic-list.js
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this PR was already merged in mas repository these files should now be regenerated from /main branch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
|
||
// src/merch-mnemonic-list.js | ||
import { html, css, LitElement } from "/libs/deps/lit-all.min.js"; | ||
var MerchMnemonicList = class extends LitElement { | ||
static styles = css` | ||
:host { | ||
display: flex; | ||
flex-direction: row; | ||
gap: 10px; | ||
margin-bottom: 10px; | ||
align-items: flex-end; | ||
} | ||
|
||
::slotted([slot='icon']) { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: max-content; | ||
} | ||
|
||
::slotted([slot='description']) { | ||
font-size: 14px; | ||
line-height: 21px; | ||
margin: 0; | ||
} | ||
|
||
:host .hidden { | ||
display: none; | ||
} | ||
`; | ||
static properties = { | ||
description: { type: String, attribute: true } | ||
}; | ||
constructor() { | ||
super(); | ||
} | ||
render() { | ||
return html` | ||
<slot name="icon"></slot> | ||
<slot name="description">${this.description}</slot> | ||
`; | ||
} | ||
}; | ||
customElements.define("merch-mnemonic-list", MerchMnemonicList); | ||
export { | ||
MerchMnemonicList | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed