Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | 4x 4x 4x 1x 1x 1x | import PropTypes from 'prop-types'
import { fetchContent } from '../lib/cms'
import { useState } from 'react'
import DottedLine from '../components/DottedLine'
import Calendar from '../components/Calendar'
import CalendarList from '../components/CalendarList'
import enEvents from '../locales/events/en'
import frEvents from '../locales/events/fr'
import eventsFromFile from '../public/events'
export default function Events({ locale, events }) {
const [isCalendarView, setCalendarView] = useState(1)
const t = locale === 'en' ? enEvents : frEvents
return (
<div className="max-w-4xl mx-auto">
<h1 className="text-center">{t.title}</h1>
<DottedLine />
{isCalendarView ? (
<Calendar
isCalendarView={isCalendarView}
toggleCalenderView={setCalendarView}
events={events}
t={t}
/>
) : (
<CalendarList
isCalendarView={isCalendarView}
toggleCalenderView={setCalendarView}
events={events}
t={t}
/>
)}
</div>
)
}
export async function getStaticProps({ locale }) {
// const content = await fetchContent()
/* istanbul ignore next */
const langToggleLink = locale === 'en' ? '/fr/events' : '/events'
/* Place-holder Meta Data Props */
const meta = {
data_en: {
title: 'Digital Dojo - Events',
desc: 'English',
author: '',
keywords: '',
},
data_fr: {
title: 'Dojo Numérique - Événements',
desc: 'Français',
author: '',
keywords: '',
},
}
return {
props: {
locale,
langToggleLink,
// content,
meta,
events: eventsFromFile.events,
},
}
}
Events.propTypes = {
/**
* current locale in the address
*/
locale: PropTypes.string,
/*
* Meta Tags
*/
meta: PropTypes.object,
}
|