From bff2d8c0eb707aa0e6ab0f53395632782ff46e6a Mon Sep 17 00:00:00 2001 From: Shivangi Singh Date: Thu, 18 Apr 2024 11:58:29 +0530 Subject: [PATCH] Event templates --- templates/event/event.css | 30 ++++++++++++++++++++++++++++++ templates/event/event.js | 22 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 templates/event/event.css create mode 100644 templates/event/event.js diff --git a/templates/event/event.css b/templates/event/event.css new file mode 100644 index 0000000..3e8a4f9 --- /dev/null +++ b/templates/event/event.css @@ -0,0 +1,30 @@ +.event main .section > div, +.event main .section div + .default-content-wrapper { + padding-top: 0; +} + +.event main .section .default-content-wrapper h2:only-child { + padding-bottom: 20px; +} + +.event main .section .default-content-wrapper { + padding-top: 15px; + padding-bottom: 15px; +} + +.event .event-title { + font-size: 36px; +} + +.event .find-out-more { + padding: 30px 0; + margin-right: 8px; +} + +.event .find-out-more .fa-external-link { + color: inherit; +} + +.event main .event-container p:last-of-type { + padding-bottom: 100px; +} diff --git a/templates/event/event.js b/templates/event/event.js new file mode 100644 index 0000000..33685fe --- /dev/null +++ b/templates/event/event.js @@ -0,0 +1,22 @@ +import { + div, +} from '../../scripts/dom-builder.js'; + +async function renderDetails(insertAfterElement) { + const summary = div({ class: 'event-summary' }); + insertAfterElement.parentNode.insertBefore(summary, insertAfterElement.nextSibling); +} + +export default async function buildAutoBlocks() { + const title = document.getElementById('event-details'); + if (title) title.classList.add('event-title'); + + const moreBtn = document.querySelector('main strong > a:last-of-type'); + if (moreBtn) { + moreBtn.setAttribute('target', '_blank'); + const par = moreBtn.closest('p'); + par.classList.add('find-out-more'); + } + + renderDetails(title); +}