1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-11-24 18:52:55 +01:00

Merge pull request #230 from bigchaindb/fix/empty-meetup

Check for existing next meetup
This commit is contained in:
Matthias Kretschmann 2018-05-03 17:10:54 +02:00 committed by GitHub
commit 118f458c3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,15 +7,23 @@ document.addEventListener('DOMContentLoaded', function() {
// just grab the first item of array
const nextEvent = events[0]
const element = document.getElementsByClassName('js-social-link--meetup')[0]
if (nextEvent) {
const name = nextEvent.name
const link = nextEvent.link
const date = new Date(nextEvent.time).toLocaleDateString('en-us', { month: 'short', day: 'numeric' })
const element = document.getElementsByClassName('js-social-link--meetup')[0]
const date = new Date(nextEvent.time).toLocaleDateString('en-us', {
month: 'short',
day: 'numeric'
})
const elementTitle = document.getElementsByClassName('meetup-title')[0]
elementTitle.innerHTML = '<span class="hero__community__label">' + date + '</span> ' + '<strong>' + name + '</strong>'
elementTitle.innerHTML = `<span class="hero__community__label">${date}</span><strong>${name}</strong>`
elementTitle.style.opacity = 1
element.href = link
} else {
element.classList.add('hide')
}
}
fetch(url)