Skip to content

Commit

Permalink
Merge pull request #44 from hlxsites/feature/contactus
Browse files Browse the repository at this point in the history
contact us initial code
  • Loading branch information
pardeepgera23 authored Oct 25, 2023
2 parents 77eaf6d + 3865c29 commit b0aeb5f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions blocks/contactus/contactus.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Only comments */
27 changes: 27 additions & 0 deletions blocks/contactus/contactus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export default function decorate() {
const contactUsClass = document.getElementsByClassName('contactus block');
contactUsClass[0].setAttribute('id', 'section-support');
contactUsClass[0].children[0].setAttribute('class', 'outer');
contactUsClass[0].children[0].children[0].setAttribute('class', 'text');
const contactUsDiv = contactUsClass[0].children[0].children[0];
const pTags = contactUsDiv.getElementsByTagName('p');
let innerElements = '';
let phone = '';
for (let i = 0; i < pTags.length; i += 1) {
if (i === 0) {
const ContactUsTitle = pTags[i].outerHTML.replace(/<p>/g, '<h2>');
innerElements += ContactUsTitle.replace(/<\/p>/g, '</h2>');
} else if (i === 1) {
innerElements += pTags[i].outerHTML;
} else if (i === 3) {
phone = pTags[2].outerHTML.replace(/<p>/g, `<a class='phone' href="tel:' ${pTags[2].innerHTML.trim()} '">`);
phone.replace(/<\/p>/g, '</a>');
pTags[i].innerHTML = `<div class="buttons">' ${
phone + pTags[i].innerHTML
} '</div>`;
const button = pTags[i].outerHTML.replace(/<p>/g, '');
innerElements += button.replace(/<\/p>/g, '');
}
}
contactUsDiv.innerHTML = innerElements;
}

0 comments on commit b0aeb5f

Please sign in to comment.