Skip to content

Commit d1b096f

Browse files
committed
chore: Deploy EDS blocks from migration tool
1 parent 9ce410f commit d1b096f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3699
-72
lines changed

blocks/aemform/aemform.css

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* aemform Block Styles
3+
* Generated by NxPlatform Migration Tool
4+
*/
5+
6+
.aemform {
7+
display: block;
8+
padding: var(--spacing-l);
9+
}
10+
11+
.aemform .jcr:primaryType {
12+
margin-bottom: var(--spacing-m);
13+
}
14+
15+
.aemform .sling:resourceType {
16+
margin-bottom: var(--spacing-m);
17+
}
18+
19+
.aemform .formType {
20+
margin-bottom: var(--spacing-m);
21+
}
22+
23+
.aemform .thankyouConfig {
24+
margin-bottom: var(--spacing-m);
25+
}
26+
27+
.aemform .enableFocusOnFirstField {
28+
margin-bottom: var(--spacing-m);
29+
}
30+
31+
.aemform .formRef {
32+
margin-bottom: var(--spacing-m);
33+
}
34+
35+
.aemform .submitType {
36+
margin-bottom: var(--spacing-m);
37+
}
38+
39+
.aemform .textIsRich {
40+
margin-bottom: var(--spacing-m);
41+
}
42+
43+
.aemform .thankyouMessage {
44+
margin-bottom: var(--spacing-m);
45+
}
46+
47+
.aemform .useiframe {
48+
margin-bottom: var(--spacing-m);
49+
}
50+
51+
/* Responsive styles */
52+
@media (min-width: 900px) {
53+
.aemform {
54+
padding: var(--spacing-xl);
55+
}
56+
}
57+
58+

blocks/aemform/aemform.js

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/**
2+
* aemform Block
3+
* Generated by NxPlatform Migration Tool
4+
*/
5+
6+
export default function decorate(block) {
7+
// Get block configuration
8+
const config = readBlockConfig(block);
9+
10+
// Process rows and cells
11+
const rows = [...block.children];
12+
13+
rows.forEach((row, index) => {
14+
const cells = [...row.children];
15+
16+
cells.forEach((cell, cellIndex) => {
17+
// Add semantic classes based on field mapping
18+
const fieldName = getFieldName(index, cellIndex);
19+
if (fieldName) {
20+
cell.classList.add(fieldName);
21+
}
22+
23+
// Process images
24+
processImages(cell);
25+
26+
// Process links
27+
processLinks(cell);
28+
});
29+
});
30+
31+
// Add block-specific initialization
32+
initializeBlock(block, config);
33+
}
34+
35+
/**
36+
* Read block configuration from data attributes
37+
*/
38+
function readBlockConfig(block) {
39+
const config = {};
40+
[...block.querySelectorAll(':scope > div > div')].forEach((cell) => {
41+
const key = cell.textContent?.trim().toLowerCase().replace(/\s+/g, '-');
42+
const value = cell.nextElementSibling?.textContent?.trim();
43+
if (key && value) {
44+
config[key] = value;
45+
}
46+
});
47+
return config;
48+
}
49+
50+
/**
51+
* Map row/cell index to field name
52+
*/
53+
function getFieldName(rowIndex, cellIndex) {
54+
const fieldMap = {
55+
'0-0': 'jcr:primaryType',
56+
'0-1': 'sling:resourceType',
57+
'1-0': 'formType',
58+
'1-1': 'thankyouConfig',
59+
'2-0': 'enableFocusOnFirstField',
60+
'2-1': 'formRef',
61+
'3-0': 'submitType',
62+
'3-1': 'textIsRich',
63+
'4-0': 'thankyouMessage',
64+
'4-1': 'useiframe'
65+
};
66+
return fieldMap[`${rowIndex}-${cellIndex}`];
67+
}
68+
69+
/**
70+
* Process images in a cell
71+
*/
72+
function processImages(cell) {
73+
const images = cell.querySelectorAll('img');
74+
images.forEach((img) => {
75+
// Add lazy loading
76+
img.loading = 'lazy';
77+
78+
// Wrap in picture element if not already
79+
if (img.parentElement.tagName !== 'PICTURE') {
80+
const picture = document.createElement('picture');
81+
img.parentElement.insertBefore(picture, img);
82+
picture.appendChild(img);
83+
}
84+
});
85+
}
86+
87+
/**
88+
* Process links in a cell
89+
*/
90+
function processLinks(cell) {
91+
const links = cell.querySelectorAll('a');
92+
links.forEach((link) => {
93+
// Add target blank for external links
94+
if (link.hostname !== window.location.hostname) {
95+
link.target = '_blank';
96+
link.rel = 'noopener noreferrer';
97+
}
98+
});
99+
}
100+
101+
/**
102+
* Initialize block functionality
103+
*/
104+
function initializeBlock(block, config) {
105+
// Add loaded class for CSS transitions
106+
block.classList.add('loaded');
107+
108+
// Dispatch custom event for extensibility
109+
block.dispatchEvent(new CustomEvent('block:loaded', {
110+
detail: { config },
111+
bubbles: true,
112+
}));
113+
}

blocks/aemform/aemform.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"id": "aemform",
3+
"fields": [
4+
{
5+
"component": "text",
6+
"name": "jcr:primaryType",
7+
"label": "Jcr:Primary Type"
8+
},
9+
{
10+
"component": "text",
11+
"name": "sling:resourceType",
12+
"label": "Sling:Resource Type"
13+
},
14+
{
15+
"component": "text",
16+
"name": "formType",
17+
"label": "Form Type"
18+
},
19+
{
20+
"component": "text",
21+
"name": "thankyouConfig",
22+
"label": "Thankyou Config"
23+
},
24+
{
25+
"component": "text",
26+
"name": "enableFocusOnFirstField",
27+
"label": "Enable Focus On First Field"
28+
},
29+
{
30+
"component": "text",
31+
"name": "formRef",
32+
"label": "Form Ref"
33+
},
34+
{
35+
"component": "text",
36+
"name": "submitType",
37+
"label": "Submit Type"
38+
},
39+
{
40+
"component": "richtext",
41+
"name": "textIsRich",
42+
"label": "Text Is Rich"
43+
},
44+
{
45+
"component": "text",
46+
"name": "thankyouMessage",
47+
"label": "Thankyou Message"
48+
},
49+
{
50+
"component": "boolean",
51+
"name": "useiframe",
52+
"label": "Useiframe"
53+
}
54+
]
55+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/**
2+
* background-container Block Styles
3+
* Generated by NxPlatform Migration Tool
4+
*/
5+
6+
.background-container {
7+
display: block;
8+
padding: var(--spacing-l);
9+
}
10+
11+
.background-container .jcr:primaryType {
12+
margin-bottom: var(--spacing-m);
13+
}
14+
15+
.background-container .sling:resourceType {
16+
margin-bottom: var(--spacing-m);
17+
}
18+
19+
.background-container .backgroundType {
20+
margin-bottom: var(--spacing-m);
21+
}
22+
23+
.background-container .bgColor {
24+
margin-bottom: var(--spacing-m);
25+
}
26+
27+
.background-container .containerWidth {
28+
margin-bottom: var(--spacing-m);
29+
}
30+
31+
.background-container .contentposition {
32+
margin-bottom: var(--spacing-m);
33+
}
34+
35+
.background-container .description {
36+
margin-bottom: var(--spacing-m);
37+
}
38+
39+
.background-container .gradientColor {
40+
margin-bottom: var(--spacing-m);
41+
}
42+
43+
.background-container .imageType {
44+
margin-bottom: var(--spacing-m);
45+
}
46+
47+
.background-container .linkIcon {
48+
margin-bottom: var(--spacing-m);
49+
}
50+
51+
.background-container .linkType {
52+
margin-bottom: var(--spacing-m);
53+
}
54+
55+
.background-container .parallaxEffect {
56+
margin-bottom: var(--spacing-m);
57+
}
58+
59+
.background-container .targetType {
60+
margin-bottom: var(--spacing-m);
61+
}
62+
63+
.background-container .textIsRich {
64+
margin-bottom: var(--spacing-m);
65+
}
66+
67+
.background-container .textPanelColor {
68+
margin-bottom: var(--spacing-m);
69+
}
70+
71+
.background-container .transparency {
72+
margin-bottom: var(--spacing-m);
73+
}
74+
75+
/* Responsive styles */
76+
@media (min-width: 900px) {
77+
.background-container {
78+
padding: var(--spacing-xl);
79+
}
80+
}
81+
82+

0 commit comments

Comments
 (0)