diff --git a/blocks/contactus/contactus.js b/blocks/contactus/contactus.js index 8333e3f0..8cdf7ce5 100644 --- a/blocks/contactus/contactus.js +++ b/blocks/contactus/contactus.js @@ -13,18 +13,19 @@ export default function decorate() { let phone = ''; for (let i = 0; i < pTags.length; i += 1) { if (i === 0) { - const ContactUsTitle = pTags[i].outerHTML.replace(/

/g, '

'); - innerElements += ContactUsTitle.replace(/<\/p>/g, '

'); + const contactUsTitle = pTags[i].outerHTML.replace(/

/g, '

'); + innerElements += contactUsTitle.replace(/<\/p>/g, '

'); } else if (i === 1) { innerElements += pTags[i].outerHTML; - } else if (i === 3) { - const contactNumber = pTags[2].innerHTML.trim(); - const contactNumberReplace = contactNumber.replace(/[()-\s]/g, ''); - phone = pTags[2].outerHTML.replace(/

/g, ``); - phone.replace(/<\/p>/g, ''); - pTags[i].innerHTML = `

${phone + pTags[i].innerHTML}
`; - const button = pTags[i].outerHTML.replace(/

/g, ''); - innerElements += button.replace(/<\/p>/g, ''); + } else if (i === 2) { + phone = pTags[i].innerText; + const anchor = document.createElement('a'); + anchor.classList.add('phone'); + anchor.setAttribute('href', `tel:${phone}`); + anchor.innerText = phone; + innerElements += anchor.outerHTML; // Use anchor.outerHTML here + } else { + innerElements += pTags[i].outerHTML; } } contactUsDiv.innerHTML = innerElements; diff --git a/styles/template.css b/styles/template.css index fb1f2247..f15e2666 100644 --- a/styles/template.css +++ b/styles/template.css @@ -490,6 +490,7 @@ body { display: block; font-size: 26px; font-weight: 700; + margin-top: 30px; margin-bottom: 15px; text-decoration: none }