Skip to content

Commit

Permalink
events: Show upcoming events on home page
Browse files Browse the repository at this point in the history
  • Loading branch information
eth-p committed Jul 27, 2022
1 parent f8654d4 commit 67a072c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/components/ShortUpcomingEvent.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import styles from '../css/ShortUpcomingEvent.module.css'
import useMediaQuery from '../utils/useMediaQuery'
import allEvents from '../utils/upcomingEvents'
import {byDate} from '../utils/upcomingEvents'
import UpcomingEvent from './UpcomingEvent'

const EventSelector = props => {
const isDesktop = useMediaQuery('(min-width: 600px)')
const events = byDate.slice(0, 3);

return (
<div
Expand All @@ -19,9 +20,9 @@ const EventSelector = props => {
<div
className={isDesktop ? styles.eventsNotes : styles.eventsNotesMobile}
>
{allEvents.map((event, i) => (
{events.map((event, i) => (
<>
{i < 3 && (
{
<div className={!isDesktop && styles.notesMargin}>
<UpcomingEvent
primaryColor={event.primaryColor && event.primaryColor}
Expand All @@ -35,17 +36,15 @@ const EventSelector = props => {
fbEvent={event.fbEvent}
/>
</div>
)}
}
</>
))}
{allEvents.length <= 0 &&
<p
style={isDesktop ? { fontSize: '2rem' } : { fontSize: '1rem' }}
className={styles.title}
>
Stay tuned for future events
</p>
}
<p
style={isDesktop ? { fontSize: '30px' } : { fontSize: '18px' }}
className={styles.title}
>
{events.length > 0 ? '' : 'Stay tuned for future events'}
</p>
</div>
</div>
)
Expand Down

0 comments on commit 67a072c

Please sign in to comment.