Skip to content
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

541-converter-update-for-column #542

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blocks/columns/columns.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}

.columns > div > div:first-child {
@apply align-text-top h-full pb-7 py-0 my-0;
@apply align-text-top pb-7 py-0 my-0;
}

.columns h2 {
Expand Down
2 changes: 2 additions & 0 deletions blocks/columns/columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default function decorate(block) {
img.width = this.width;
img.height = Math.floor(this.width / imageAspectRatio);
};
} else if (![...block.classList].includes('itemscenter')) {
col.classList.add('h-full');
}

const pic = col.querySelector('picture');
Expand Down
19 changes: 13 additions & 6 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -296,18 +296,26 @@
text-decoration-line: underline;
text-decoration-color: #3bc7e5;
text-decoration-thickness: 3px;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-duration: 700ms;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.application main .columns > div div > p:not(.button-container) a:hover {
--tw-bg-opacity: 1;
background-color: rgb(59 199 229 / var(--tw-bg-opacity));
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-duration: 150ms;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 768px) {

.application main .columns > div div > p:not(.button-container) a {
overflow-wrap: normal;
word-break: normal;
}
}

.testimonial>div {
Expand Down Expand Up @@ -539,7 +547,6 @@
.columns > div > div:first-child {
margin-top: 0px;
margin-bottom: 0px;
height: 100%;
padding-top: 0px;
padding-bottom: 0px;
padding-bottom: 1.75rem;
Expand Down
18 changes: 9 additions & 9 deletions tools/actions/convert/test/fixtures/blog2-converted.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1>9 Essential Products for Streamlining Your mRNA Development and Manufacturin
<img src="https://s7d9.scene7.com/is/image/danaherstage/nine-essential-products" alt="">
</p>
<p>In the realm of life sciences, the tools you employ can significantly influence your work's efficiency and outcomes. For scientists, lab managers, and lab directors involved in mRNA development and manufacturing, having the right instruments at your fingertips can be a game-changer. Here, we spotlight nine indispensable products from <a href="/us/en/about-us/danaher-business-system.html" title="Danaher Business System">Danaher Life Science companies</a> that are revolutionizing this field.</p>
<div class="columns">
<div class="columns itemscenter">
<div>
<div>
<h2>1. Biomek i7 Automated Liquid Handlers</h2>
Expand All @@ -35,7 +35,7 @@ <h2>1. Biomek i7 Automated Liquid Handlers</h2>
<p>
<img src="https://s7d9.scene7.com/is/image/danaherstage/rule-line-extra-padded" alt="">
</p>
<div class="columns">
<div class="columns itemscenter">
<div>
<div>
<h2>2. Echo 525 Acoustic Liquid Handlers</h2>
Expand All @@ -50,7 +50,7 @@ <h2>2. Echo 525 Acoustic Liquid Handlers</h2>
<p>
<img src="https://s7d9.scene7.com/is/image/danaherstage/rule-line-extra-padded" alt="">
</p>
<div class="columns">
<div class="columns itemscenter">
<div>
<div>
<h2>3. Intabio ZT System</h2>
Expand All @@ -65,7 +65,7 @@ <h2>3. Intabio ZT System</h2>
<p>
<img src="https://s7d9.scene7.com/is/image/danaherstage/rule-line-extra-padded" alt="">
</p>
<div class="columns">
<div class="columns itemscenter">
<div>
<div>
<h2>4. IDBS Polar</h2>
Expand All @@ -80,7 +80,7 @@ <h2>4. IDBS Polar</h2>
<p>
<img src="https://s7d9.scene7.com/is/image/danaherstage/rule-line-extra-padded" alt="">
</p>
<div class="columns">
<div class="columns itemscenter">
<div>
<div>
<h2>5. Biophase 8800 Capillary Electrophoresis Systems</h2>
Expand All @@ -95,7 +95,7 @@ <h2>5. Biophase 8800 Capillary Electrophoresis Systems</h2>
<p>
<img src="https://s7d9.scene7.com/is/image/danaherstage/rule-line-extra-padded" alt="">
</p>
<div class="columns">
<div class="columns itemscenter">
<div>
<div>
<h2>6. SpectraMax Microplate Readers</h2>
Expand All @@ -110,7 +110,7 @@ <h2>6. SpectraMax Microplate Readers</h2>
<p>
<img src="https://s7d9.scene7.com/is/image/danaherstage/rule-line-extra-padded" alt="">
</p>
<div class="columns">
<div class="columns itemscenter">
<div>
<div>
<h2>7. ZenoTOF 7600 Mass Spectrometer</h2>
Expand All @@ -125,7 +125,7 @@ <h2>7. ZenoTOF 7600 Mass Spectrometer</h2>
<p>
<img src="https://s7d9.scene7.com/is/image/danaherstage/rule-line-extra-padded" alt="">
</p>
<div class="columns">
<div class="columns itemscenter">
<div>
<div>
<h2>8. BioZen Oligo Analytical HPLC Columns</h2>
Expand All @@ -140,7 +140,7 @@ <h2>8. BioZen Oligo Analytical HPLC Columns</h2>
<p>
<img src="https://s7d9.scene7.com/is/image/danaherstage/rule-line-extra-padded" alt="">
</p>
<div class="columns">
<div class="columns itemscenter">
<div>
<div>
<h2>9. Skyland PIMS</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h3>Sciex</h3>
<div class="columns">
<div>
<div>
<h1>PRODUCT SPOTLIGHT</h1>
<p><strong>PRODUCT SPOTLIGHT</strong></p>
<h2>Intabio ZT System</h2>
<p>Comprehensive charge variant analysis made simple. The Intabio ZT system couples icIEF separation and UV detection with high resolution mass spectrometry on the ZenoTOF 7600 system</p>
<p><a href="/us/en/products/family/intabio-zt-systems.html">Learn More</a></p>
Expand Down
31 changes: 20 additions & 11 deletions tools/importer/transformers/twoColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import {
const createTwoColumn = (main, document) => {
main.querySelectorAll('grid[columns="2"]').forEach((item) => {
const columns = [];
const cells = [];
if (item?.getAttribute('itemscenter')) cells.push([['Columns (itemscenter)']]);
else cells.push([['Columns']]);

const templates = item.querySelectorAll('template');
[...templates].forEach((template) => {
if (template.content.children.length > 0) {
Expand All @@ -30,19 +34,27 @@ const createTwoColumn = (main, document) => {
}
} else if (element.className === 'heading-aem') {
const heading = template.content.querySelector('div.heading-aem');

if (heading) {
row.push(heading.firstElementChild);
if (heading.nextElementSibling && [...heading.nextElementSibling.classList].includes('featureimage')) {
const text = document.createElement('strong');
text.textContent = heading.firstElementChild.textContent;
row.push(text);
} else row.push(heading.firstElementChild);
}
} else if (element.className === 'heading') {
const heading = template.content.querySelector('div.heading');

if (heading) {
const headingEL = heading?.querySelector('heading');
const hTag = headingEL?.getAttribute('headingtag') ? headingEL?.getAttribute('headingtag') : 'h1';
const headEl = document.createElement(hTag);
headEl.textContent = headingEL?.getAttribute('heading');
row.push(headEl);
if (heading.nextElementSibling && [...heading.nextElementSibling.classList].includes('featureimage')) {
const text = document.createElement('strong');
text.textContent = headingEL?.getAttribute('heading');
row.push(text);
} else {
const hTag = headingEL?.getAttribute('headingtag') ? headingEL?.getAttribute('headingtag') : 'h2';
const headEl = document.createElement(hTag);
headEl.textContent = headingEL?.getAttribute('heading');
row.push(headEl);
}
}
} else if (element.className === 'script') {
const featureImage = template.content.querySelector('div.featureimage');
Expand All @@ -55,10 +67,7 @@ const createTwoColumn = (main, document) => {
columns.push(row);
}
});
const cells = [
['Columns'],
[...columns],
];
cells.push([...columns]);

if (columns.length > 0) {
const block = WebImporter.DOMUtils.createTable(cells, document);
Expand Down