Skip to content

Commit

Permalink
Merge pull request #280 from hlxsites/bug/post-form
Browse files Browse the repository at this point in the history
Bug/post form
  • Loading branch information
pardeepgera23 authored Dec 27, 2023
2 parents 0a49e5d + 7fed604 commit 4026eae
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
4 changes: 3 additions & 1 deletion blocks/accordion/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ export default function decorate(block) {
ele.remove();
}
});
faqRows.forEach((row) => {
faqRows.forEach((row, index) => {
const faqQuestion = [...row.children][0];
faqQuestion.classList.add('faq-question');
faqQuestion.id = `faq-question-${index}`;
faqQuestion.addEventListener('click', (e) => {
const currentFaq = e.currentTarget.classList.contains('active');
const openfaq = block.querySelector('.faq-question.active');
Expand All @@ -64,6 +65,7 @@ export default function decorate(block) {
openfaq.nextElementSibling.style.maxHeight = 0;
setTimeout(() => {
openfaq.nextElementSibling.classList.toggle('active');
faqQuestion.scrollIntoView({ behavior: 'smooth' });
}, 300);
}
setTimeout(() => {
Expand Down
4 changes: 4 additions & 0 deletions blocks/recent-posts/recent-posts.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
height: auto;
}

.full-post .text {
padding-left: 0!important;
}

@media (max-width: 1024px) {
.grey-article-outer {
padding-left: 20px;
Expand Down
6 changes: 5 additions & 1 deletion blocks/recent-posts/recent-posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ function createRecentPosts(results) {
const articleDescription = p({ class: 'intro' }, truncateText(post.description, 180));
articleCardBody.appendChild(articleHeading);
articleCardBody.appendChild(articleDescription);
showcaseBanner.appendChild(articleCardImage);
if (post.image) {
showcaseBanner.appendChild(articleCardImage);
} else {
showcaseBanner.classList.add('full-post');
}
showcaseBanner.appendChild(articleCardBody);
lists.append(showcaseBanner);
});
Expand Down
20 changes: 20 additions & 0 deletions scripts/aem.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,15 @@ function buildForm(hbspt) {
config.redirectUrl = formData.redirecturl;
}
hbspt.forms.create(config);
const TargetElement = document.querySelector(config.target);
if (TargetElement) {
setTimeout(() => {
const submitButtons = TargetElement.querySelector('input[type="submit"]');
submitButtons.addEventListener('click', () => {
TargetElement.scrollIntoView({ behavior: 'smooth' });
});
}, 1000);
}
});
}

Expand Down Expand Up @@ -544,6 +553,17 @@ function decorateButtons(element) {
a.classList.add('style-normal');
a.classList.add('button');
}
if (
a && a.href.includes('tel:')
&& up.tagName === 'P'
&& up.childNodes.length === 1
) {
while (a.classList.length > 0) {
a.classList.remove(a.classList.item(0));
}
a.removeAttribute('href');
a.classList.add('normal-text');
}
}
}
});
Expand Down
16 changes: 15 additions & 1 deletion styles/Typo.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

html {
scroll-behavior: smooth;
scroll-padding-top: 120px;
scroll-padding-top: 150px;
}

.img-colorbox-popup::after,
Expand Down Expand Up @@ -2081,3 +2081,17 @@ form.hs-form .hs-input[type="checkbox"] {
}
}

.normal-text {
font-size: inherit;
color: inherit;
text-decoration: none;
cursor: inherit;
}

.normal-text:hover {
font-size: inherit;
color: inherit;
text-decoration: none;
cursor: inherit;
}

0 comments on commit 4026eae

Please sign in to comment.