Skip to content

Commit

Permalink
Merge pull request #271 from hlxsites/bug/hot-fixes
Browse files Browse the repository at this point in the history
Bug/hot fixes
  • Loading branch information
pardeepgera23 authored Dec 18, 2023
2 parents 3d53482 + 59c1b3e commit b91e202
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
21 changes: 11 additions & 10 deletions blocks/contactus/contactus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(/<p>/g, '<h2>');
innerElements += ContactUsTitle.replace(/<\/p>/g, '</h2>');
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) {
const contactNumber = pTags[2].innerHTML.trim();
const contactNumberReplace = contactNumber.replace(/[()-\s]/g, '');
phone = pTags[2].outerHTML.replace(/<p>/g, `<a class='phone' href="tel:${contactNumberReplace}">`);
phone.replace(/<\/p>/g, '</a>');
pTags[i].innerHTML = `<br><div class="buttons"> ${phone + pTags[i].innerHTML} </div>`;
const button = pTags[i].outerHTML.replace(/<p>/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;
Expand Down
1 change: 1 addition & 0 deletions styles/template.css
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ body {
display: block;
font-size: 26px;
font-weight: 700;
margin-top: 30px;
margin-bottom: 15px;
text-decoration: none
}
Expand Down

0 comments on commit b91e202

Please sign in to comment.