diff --git a/services2.html b/services2.html index 5ef17cb..a8f1643 100644 --- a/services2.html +++ b/services2.html @@ -502,6 +502,8 @@ ] }; + + function insertServices(serviceData) { for (const category of categories) { let categoryData = serviceData[category]; @@ -511,6 +513,8 @@ let target = document.getElementById(category); for (const service of categoryData) { + let leftSide = buildCardColumn(service.left); + let rightSide = buildCardColumn(service.right); target.insertAdjacentHTML( "beforeend", ` @@ -520,35 +524,35 @@

${service.subtitle}

- -

Interior

- -
- -

Exterior

- -
+ ${leftSide ? leftSide : ""} + ${rightSide ? rightSide : ""}
`); } - // for each side, only rdner header, paragraph, bullets, if they exist (and in that order) - } } - + + function buildCardColumn(data) { + let html = ""; + if (data.header) { + html += "

" + data.header + "

"; + } + if (data.paragraph) { + html += "

" + data.paragraph + "

"; + } + if (data.bullets) { + html += ""; + } + html += "
"; + if (html == "") return null; + return html; + } + // insert services upon page load window.onload = (event) => { insertServices(serviceData);