Skip to content

Commit

Permalink
Updating to check for options
Browse files Browse the repository at this point in the history
  • Loading branch information
davenichols-DHLS committed Jul 17, 2024
1 parent 177143f commit 233876f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions blocks/event-summary/event-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ export default async function decorate(block) {
const image = getMetadata('og:image');
const registerButton = getMetadata('register-button');
const title = getMetadata('og:title');
const description = getMetadata('og:description');
const type = getMetadata('type');
const region = getMetadata('region');
const address = getMetadata('address');
const eventTitle = document.querySelector('.eventtitle.block');
const eventSummary = document.querySelector('.eventsummary.block');

const outerBlock = document.querySelector('.section');
Expand All @@ -41,7 +43,7 @@ export default async function decorate(block) {
{ class: 'event-date' },
`${date} ${eventTime}`,
) : p({ class: 'event-date' }, date));
const eventSubtitle = h1({ class: 'event-subtitle' }, title);
const eventSubtitle = h1({ class: 'event-subtitle' }, eventTitle.textContent ? eventTitle : title);
const keywordList = ul(
{ class: 'keyword-list' },
li({ class: 'item type' }, type),
Expand All @@ -59,7 +61,7 @@ export default async function decorate(block) {

// 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, registerButtonContainer, talkButtonContainer)));
block.appendChild(div({ class: 'event-details' }, eventDate, eventSubtitle, div({ class: 'event-keywords' }, keywordList), div({ class: 'event-description' }, eventSummary.textContent ? eventSummary : description, registerButtonContainer, talkButtonContainer)));

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

0 comments on commit 233876f

Please sign in to comment.