Skip to content

Commit

Permalink
Merge pull request #226 from hlxsites/feature/order-form
Browse files Browse the repository at this point in the history
created the order form
  • Loading branch information
pardeepgera23 authored Dec 8, 2023
2 parents 3ebf7c6 + b80982c commit 1399981
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blocks/order-form/order-form.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.order-form .table_order button {
font-size: 12px!important;
padding: 0.8em 0.9em!important;
transition: all 0.3s ease;
}
20 changes: 20 additions & 0 deletions blocks/order-form/order-form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default function buildAutoBlocks(block) {
const para = block.innerText;
block.innerHTML = para;
const forms = block.querySelectorAll('form');
forms.forEach((form) => {
const originalUrl = form.action;
const continueUrl = window.location.href;
// Replace the 'continue' parameter or add it if it doesn't exist
form.action = originalUrl.replace(/(\?|&)continue=([^&]*)/, `$1continue=${continueUrl}`);
});
const accordions = block.querySelectorAll('.mmg-collapsible');
if (accordions.length > 0) {
accordions.forEach((accordion) => {
accordion.children[0].addEventListener('click', () => {
const content = accordion.querySelector('.content');
content.style.display = content.style.display === 'none' ? 'block' : 'none';
});
});
}
}

0 comments on commit 1399981

Please sign in to comment.