Skip to content

Commit

Permalink
Updated sidebar style
Browse files Browse the repository at this point in the history
  • Loading branch information
raj-bluetext committed Aug 9, 2024
1 parent 178e0ac commit 66e0eb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
11 changes: 0 additions & 11 deletions blocks/marketo-2/marketo-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ export default function decorate(block) {
const formId = blockConfig['form-id'];
const successUrl = blockConfig['success-url'];

const marketo2container = document.querySelector('.section.marketo-2-container');
// Get the child elements
const m2children = Array.from(marketo2container.children);

if (formId && marketoId) {
// Create the form element
const formElement = createTag('form', { id: `mktoForm_${formId}` });
Expand All @@ -133,12 +129,5 @@ export default function decorate(block) {

// Start observing the block
observer.observe(block);

// Reverse the order of the child elements
m2children.reverse();
// Append the children back in reversed order
m2children.forEach((child) => {
marketo2container.appendChild(child);
});
}
}
12 changes: 6 additions & 6 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,8 @@ function restructureContentLayout(main) {
return;
}

// Find the Marketo element
const marketoWrapper = main.querySelector('.marketo-wrapper');
// Find the Marketo element (either .marketo-wrapper or .marketo-2-wrapper)
const marketoWrapper = main.querySelector('.marketo-wrapper, .marketo-2-wrapper');
if (!marketoWrapper) {
return;
}
Expand All @@ -969,16 +969,16 @@ function restructureContentLayout(main) {

// Iterate through the parent-level elements
parentElements.forEach((element) => {
// Check if the element is not equal to '.marketo-wrapper'
if (!element.classList.contains('marketo-wrapper')) {
// Check if the element is not equal to '.marketo-wrapper' or '.marketo-2-wrapper'
if (!element.classList.contains('marketo-wrapper') && !element.classList.contains('marketo-2-wrapper')) {
contentBodyText.appendChild(element);
}
});

// Insert '.section-content-body__text' before '.marketo-wrapper'
// Insert '.section-content-body__text' before the Marketo wrapper element
sectionContentBody.insertBefore(contentBodyText, marketoWrapper);

// Add '.section-content-body__form' class to '.marketo-wrapper'
// Add '.section-content-body__form' class to the Marketo wrapper element
marketoWrapper.classList.add('section-content-body__form');
}
}
Expand Down

0 comments on commit 66e0eb0

Please sign in to comment.