crbtc.org/components/index/Events.vue

39 lines
1.3 KiB
Vue
Raw Normal View History

2023-07-17 19:11:13 +00:00
<script setup>
const events = await queryContent('event')
.sort({ date: -1 })
.only(['title', 'slug', 'location', 'date', 'day', 'time', 'meetup'])
2023-07-17 19:11:13 +00:00
.limit(3)
.find()
import { parseISO, addDays, isPast } from "date-fns";
2023-07-17 19:11:13 +00:00
for (let i = 0; i < events.length; i++) {
let date = addDays(parseISO(events[i].date), 1)
events[i].past = isPast(date)
// issue with 1 day ahead
// events[i].date = format(date, 'EEE, MMM d')
2023-07-17 19:11:13 +00:00
}
</script>
<template>
<div class="events" id="events">
<h4>Upcoming Events</h4>
<div v-bind:class="(event.past)?'event past':'event'" v-for="event in events" :key="event.slug">
<div class="info">
<NuxtLink :to="'/event/' + event.slug"><h5>{{ event.title }}</h5></NuxtLink>
<p class="location">{{ event.location }}</p>
<p>{{ event.day }} · {{ event.time }}</p>
2023-07-17 19:11:13 +00:00
</div>
<div v-bind:class="(event.meetup)?'attend both':'attend bottom'" >
<NuxtLink v-if="!event.past" :href="'/login?action=attend&?ref=' + event.slug" >Attend event</NuxtLink>
</div>
<div class="meetup bottom">
<NuxtLink v-if="event.meetup" target="_BLANK"
:to="'https://www.meetup.com/capitalregionbitcoinnetwork/events/' + event.meetup + '/'">Meetup.com</NuxtLink>
</div>
2023-07-17 19:11:13 +00:00
</div>
</div>
</template>