Skip to content

Commit

Permalink
Added check to the registerButton as well
Browse files Browse the repository at this point in the history
  • Loading branch information
davenichols-DHLS committed Aug 22, 2024
1 parent 28124d4 commit b541c33
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions blocks/event-summary/event-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,26 @@ export default async function decorate(block) {
} else {
registerButtonLink = a({ href: registerButton, title }, 'Register Today');
}
const registerButtonContainer = p({ class: 'button-container find-out-more' }, strong(registerButtonLink));
const talkButtonContainer = p({ class: 'button-container' }, strong(a({ href: meetingButton, title }, 'Request a Meeting/Contact Us')));

// Append elements to block
block.appendChild(imageContainer);
let registerButtonContainer;
if (registerButton) {
registerButtonContainer = p({ class: 'button-container find-out-more' }, strong(a({ href: registerButton, title }, 'Register Today')));
} else {
registerButtonContainer = '';
}

let talkButtonContainer;
if (meetingButton) {
block.appendChild(div({ class: 'event-details' }, eventDate, eventSubtitle, div({ class: 'event-keywords' }, keywordList), div({ class: 'event-description' }, eventSummary || description, registerButtonContainer, talkButtonContainer)));
talkButtonContainer = p({ class: 'button-container' }, strong(a({ href: meetingButton, title }, 'Request a Meeting/Contact Us')));
} else {
block.appendChild(div({ class: 'event-details' }, eventDate, eventSubtitle, div({ class: 'event-keywords' }, keywordList), div({ class: 'event-description' }, eventSummary || description, registerButtonContainer)));
talkButtonContainer = '';
}

// Append elements to block
block.appendChild(imageContainer);

block.appendChild(div({ class: 'event-details' }, eventDate, eventSubtitle, div({ class: 'event-keywords' }, keywordList), div({ class: 'event-description' }, eventSummary || description, registerButtonContainer, talkButtonContainer)));

// Add event listener to the 'Register Today' button
registerButtonLink.addEventListener('click', (event) => {
event.preventDefault();
Expand Down

0 comments on commit b541c33

Please sign in to comment.