Skip to content

Commit

Permalink
updated converter for full layout
Browse files Browse the repository at this point in the history
  • Loading branch information
rgravitvl committed Dec 12, 2023
1 parent d4d9a2d commit d4d1d1d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
1 change: 0 additions & 1 deletion tools/actions/convert/test/fixtures/en-converted.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ <h2>Together, we see a way</h2>
</div>
</div>
<hr>
<hr>
<div class="cards articlecard">
<div>
<div>
Expand Down
6 changes: 6 additions & 0 deletions tools/actions/convert/test/fixtures/product1-converted.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ <h3>Sciex</h3>
</div>
</div>
</div>
<div class="section-metadata">
<div>
<div>style</div>
<div>bg-white</div>
</div>
</div>
<hr>
<div class="carousel">
<div>
Expand Down
2 changes: 1 addition & 1 deletion tools/actions/convert/test/fixtures/product1.html
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ <h2 class="text-gray-900 my-2 font-extrabold text-4xl pt-0 pb-0">Discover produc
<div class="container-fullwidth aem-GridColumn aem-GridColumn--default--12">

<fulllayout class="max-w-7xl mx-auto w-full">
<div>
<div class="bg-white">
<div class="max-w-7xl mx-auto w-full px-2 sm:px-2 md:px-4 lg:px-4 xl:px-1 2xl:px-0">
<div>

Expand Down
2 changes: 0 additions & 2 deletions tools/importer/transformers/callToAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ export const c2a = (cta, document) => {
['call-to-action'], [div],
];
const block = WebImporter.DOMUtils.createTable(cells, document);
const fulllauoyt = ctaSection.closest('fulllayout');
if (fulllauoyt && fulllauoyt.querySelectorAll('*').length > 4 && fulllauoyt.querySelectorAll('*')[3].className === 'cta-section') ctaSection.append(document.createElement('hr'));
cta.append(block);
}
};
Expand Down
1 change: 0 additions & 1 deletion tools/importer/transformers/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const createCards = (main, document) => {
cells.push(...cards);

if (cards.length > 0) {
fl.before(document.createElement('hr'));
const block = WebImporter.DOMUtils.createTable(cells, document);
fl.append(block);
}
Expand Down
7 changes: 5 additions & 2 deletions tools/importer/transformers/fullLayoutSection.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
/* global WebImporter */
const createFullLayoutSection = (main, document) => {
let styleIndex = 0;
main.querySelectorAll('fulllayout').forEach((e, i, arr) => {
const div = e.querySelector('div');
const style = div.getAttribute('class');
if (style) {
if (i === 0 && e.parentNode.previousElementSibling) e.prepend(document.createElement('hr'));
if (styleIndex === 0 && e.parentNode.previousElementSibling) e.prepend(document.createElement('hr'));
const cells = [['Section Metadata'], ['style', style]];
const table = WebImporter.DOMUtils.createTable(cells, document);
e.after(table);
if ((arr.length === 1 || i < arr.length - 1) && !arr[arr.length - 1].querySelector('div.bg-danaherlightblue-50')?.querySelector('div.cta-section')) {
if ((arr.length === 1 || i < arr.length - 1)
&& !e.parentNode.nextElementSibling.className.includes('carousel')) {
table.after(document.createElement('hr'));
}
styleIndex += 1;
}
});
};
Expand Down

0 comments on commit d4d1d1d

Please sign in to comment.