-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(events): add events connection meetup.com
- Loading branch information
1 parent
77db317
commit 035a76c
Showing
13 changed files
with
1,213 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import Link from '@/components/Link' | ||
import { isFutureEvent } from '@/lib/events' | ||
|
||
const EventCalendar = ({ events }) => { | ||
return ( | ||
<ul className="m-0 flex list-none flex-col gap-8 bg-gray-100 p-8"> | ||
{events.map((event) => ( | ||
<li | ||
className={`relative m-0 bg-white p-4 ${ | ||
isFutureEvent(event.dateTime) ? '' : ' opacity-50' | ||
}`} | ||
key={event.id} | ||
> | ||
<h3 className="m-0 text-lg font-medium line-clamp-2">{event.title}</h3> | ||
<p className="m-0 text-sm line-clamp-2">{event.description}</p> | ||
<p className="m-0 mt-auto pt-6 text-xs line-clamp-2"> | ||
<time | ||
className={`font-bold ${isFutureEvent(event.dateTime) ? 'text-io_blue-600' : ''}`} | ||
dateTime={new Intl.DateTimeFormat('en-US', { | ||
day: 'numeric', | ||
month: 'long', | ||
year: 'numeric', | ||
}).format(new Date(event.dateTime))} | ||
> | ||
{new Intl.DateTimeFormat('en-US', { | ||
day: 'numeric', | ||
month: 'long', | ||
}).format(new Date(event.dateTime))} | ||
</time> | ||
{' | '} | ||
{event.groupName} | ||
</p> | ||
<Link | ||
href={event.eventUrl} | ||
target="_blank" | ||
rel="noreferrer" | ||
className="absolute top-0 right-0 bottom-0 left-0 text-0" | ||
> | ||
Go to page for {event.title} | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
) | ||
} | ||
|
||
export default EventCalendar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import Link from '@/components/Link' | ||
import { isFutureEvent } from '@/lib/events' | ||
|
||
const EventCarousel = ({ events }) => { | ||
return ( | ||
<ul className="my-12 mb-24 flex flex-col flex-wrap items-center md:snap-x md:flex-row md:flex-nowrap md:items-stretch md:gap-12 md:overflow-x-auto md:px-12"> | ||
{events.map((event) => ( | ||
<li | ||
key={event.id} | ||
className={`mb-8 shrink-0 md:mb-0 md:snap-center ${ | ||
isFutureEvent(event.dateTime) ? '' : ' opacity-50' | ||
}`} | ||
style={{ width: 500, maxWidth: '100vw' }} | ||
> | ||
<div className="relative flex h-full flex-col bg-gray-100 p-8"> | ||
<header> | ||
<h3 className="mb-2 text-3xl font-medium line-clamp-2">{event.title}</h3> | ||
|
||
<p className="hyphens-auto text-lg line-clamp-3 ">{event.description}</p> | ||
</header> | ||
<p className="m-0 mt-auto pt-6 text-xs line-clamp-2"> | ||
<time | ||
className={`font-bold ${isFutureEvent(event.dateTime) ? 'text-io_blue-600' : ''}`} | ||
dateTime={new Intl.DateTimeFormat('en-US', { | ||
day: 'numeric', | ||
month: 'long', | ||
year: 'numeric', | ||
}).format(new Date(event.dateTime))} | ||
> | ||
{new Intl.DateTimeFormat('en-US', { | ||
day: 'numeric', | ||
month: 'long', | ||
}).format(new Date(event.dateTime))} | ||
</time> | ||
{' | '} | ||
{event.groupName} | ||
</p> | ||
<Link | ||
href={event.eventUrl} | ||
target="_blank" | ||
rel="noreferrer" | ||
className="absolute top-0 right-0 bottom-0 left-0 text-0" | ||
> | ||
Go to page for {event.title} | ||
</Link> | ||
</div> | ||
</li> | ||
))} | ||
</ul> | ||
) | ||
} | ||
|
||
export default EventCarousel |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import events from '@/data/events.json' | ||
|
||
export async function getAllEvents() { | ||
return events | ||
} | ||
|
||
export async function getLatestEvents(num = 5) { | ||
const { events } = await getAllEvents() | ||
|
||
return { | ||
events: events.slice(0, num), | ||
} | ||
} | ||
|
||
export const isFutureEvent = (date) => { | ||
return new Date(date) > new Date() | ||
} | ||
|
||
export const hasFutureEvents = (events) => { | ||
return events.some((event) => isFutureEvent(event.dateTime)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.