diff --git a/src/components/EventSelector.js b/src/components/EventSelector.js index 8b3d54e..2266fe4 100644 --- a/src/components/EventSelector.js +++ b/src/components/EventSelector.js @@ -112,6 +112,7 @@ const EventSelector = props => { time={event.time} link={event.link} fbEvent={event.fbEvent} + noteProps={{expandable: true}} /> )} diff --git a/src/components/Note.js b/src/components/Note.js index 3e32130..efca5f3 100644 --- a/src/components/Note.js +++ b/src/components/Note.js @@ -8,13 +8,18 @@ const Note = ({ primaryColor = '#3D73C7', secondaryColor = '#2B5699', contentHeight, + expandable, setHovering }) => { const isDesktop = useMediaQuery('(min-width: 600px)') + const classes = [ + styles.container, + expandable ? styles.containerExpandable : null, + ] return (
x != null).join(' ')} style={{ '--primary-color': primaryColor, '--secondary-color': secondaryColor, diff --git a/src/components/ShortUpcomingEvent.js b/src/components/ShortUpcomingEvent.js index b18346d..a133040 100644 --- a/src/components/ShortUpcomingEvent.js +++ b/src/components/ShortUpcomingEvent.js @@ -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 (
{
- {allEvents.map((event, i) => ( + {events.map((event, i) => ( <> - {i < 3 && ( + {
{ time={event.time} link={event.link} fbEvent={event.fbEvent} + noteProps={{expandable: true}} />
- )} + } ))} - {allEvents.length <= 0 && -

- Stay tuned for future events -

- } +

+ {events.length > 0 ? '' : 'Stay tuned for future events'} +

) diff --git a/src/components/UpcomingEvent.js b/src/components/UpcomingEvent.js index fe6ee62..1fcfb3e 100644 --- a/src/components/UpcomingEvent.js +++ b/src/components/UpcomingEvent.js @@ -13,11 +13,12 @@ const UpcomingEvent = ({ location, time, link, - fbEvent + fbEvent, + noteProps, }) => { const isDesktop = useMediaQuery('(min-width: 600px)') return ( - +
diff --git a/src/css/EventSelector.module.css b/src/css/EventSelector.module.css index 1f18a62..c5a8f40 100644 --- a/src/css/EventSelector.module.css +++ b/src/css/EventSelector.module.css @@ -42,7 +42,19 @@ min-height: 631px; grid-row-gap: 31px; grid-column-gap: 49px; - grid-template-columns: 1fr 2fr; + grid-template-columns: 1fr 1fr 1fr; +} + +@media screen and (max-width: 1200px) { + .eventsNotes { + grid-template-columns: 1fr 1fr; + } +} + +@media screen and (max-width: 840px) { + .eventsNotes { + grid-template-columns: 1fr; + } } .eventsNotesMobile { diff --git a/src/css/Note.module.css b/src/css/Note.module.css index 72def96..ab8e454 100644 --- a/src/css/Note.module.css +++ b/src/css/Note.module.css @@ -5,6 +5,11 @@ width: fit-content; } +.container.containerExpandable { + width: 100%; + max-width: 500px; +} + .pageCurl { position: absolute; bottom: 0; diff --git a/src/utils/upcomingEvents.js b/src/utils/upcomingEvents.js index 42f947d..c7dc8e9 100644 --- a/src/utils/upcomingEvents.js +++ b/src/utils/upcomingEvents.js @@ -1,4 +1,37 @@ const upcomingEvent = [ + { + title: 'Audio Workshop', + day: '28', + month: 'Jul', + location: 'SFU Library', + time: '5:30PM – 7:30PM', + link: 'https://lu.ma/a5m6mqwe', + filterSetting: 'Workshops', + fbEvent: + 'https://www.facebook.com/events/589045982841057' + }, + { + title: 'Audio Workshop', + day: '28', + month: 'Jul', + location: 'SFU Library', + time: '5:30PM – 7:30PM', + link: 'https://lu.ma/a5m6mqwe', + filterSetting: 'Workshops', + fbEvent: + 'https://www.facebook.com/events/589045982841057' + }, + { + title: 'Audio Workshop', + day: '28', + month: 'Jul', + location: 'SFU Library', + time: '5:30PM – 7:30PM', + link: 'https://lu.ma/a5m6mqwe', + filterSetting: 'Workshops', + fbEvent: + 'https://www.facebook.com/events/589045982841057' + }, { title: 'Audio Workshop', day: '28', @@ -116,4 +149,18 @@ const upcomingEvent = [ */ ] -export default upcomingEvent +export default upcomingEvent; + +// Internal Utility Functions: +function dateOf(event) { + const time = event.time.split(' - ')[0].replace(/ *([AP]M)/g, ' $1'); + return new Date(`${event.month} ${event.day} ${time}`); +} + +// byDate: The events, listed in order of closest to furthest. +export const byDate = upcomingEvent.sort((a, b) => { + const aDate = dateOf(a); + const bDate = dateOf(b); + return bDate - aDate; +}); +