-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(events): Refactor events component and add year dropdowns (#243)
* feat(events): Update event images url to include year and add industry night * feat(events): Refactor events component and add year dropdowns * chore(events): Change variable name for clarity * chore(events): Fix trailing space for industry night event * chore(events): Add comments for events sorting
- Loading branch information
1 parent
11a8967
commit 9316c15
Showing
23 changed files
with
188 additions
and
90 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,62 @@ | ||
import FancyRectangle from '@/components/FancyRectangle'; | ||
import { type Event } from '@/data/events'; | ||
import Image from 'next/image'; | ||
import { FiClock, FiMapPin } from 'react-icons/fi'; | ||
|
||
export default function EventCard({ | ||
event, | ||
index, | ||
isPastEvent, | ||
}: { | ||
event: Event; | ||
index: number; | ||
isPastEvent?: boolean; | ||
}) { | ||
return ( | ||
<FancyRectangle colour="white" offset="8" rounded fullWidth> | ||
<div className="flex w-full flex-col gap-6 rounded-xl bg-white p-4 text-black lg:flex-row"> | ||
<Image | ||
src={`/images/events/${event.image}`} | ||
alt={`${event.title}`} | ||
width={450} | ||
height={450} | ||
className={`w-full shrink-0 rounded-lg border-[3px] border-black bg-white object-contain md:w-[450px] ${isPastEvent ? 'grayscale' : ''}`} | ||
/> | ||
<div className="grow space-y-2 md:space-y-4"> | ||
<div className="flex gap-6 font-bold"> | ||
<div className="grow space-y-2"> | ||
<h4 className="text-2xl md:border-b-[3px] md:border-black md:pb-1 md:text-3xl"> | ||
{event.title} | ||
</h4> | ||
<div className="flex gap-2"> | ||
<FiClock size={26} /> | ||
<span>{event.time}</span> | ||
</div> | ||
<div className="flex gap-2"> | ||
<FiMapPin size={26} /> | ||
<span>{event.location}</span> | ||
</div> | ||
</div> | ||
<div | ||
className={`h-fit rounded-md border-[3px] border-black px-4 py-2 ${['bg-orange', 'bg-yellow', 'bg-purple'][index % 3]} ${isPastEvent ? 'grayscale' : ''}`} | ||
> | ||
<div>{event.date.month}</div> | ||
<div>{event.date.day}</div> | ||
</div> | ||
</div> | ||
<div>{event.details}</div> | ||
{event.url && ( | ||
<a | ||
href={event.url.href.toString()} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="font-bold hover:underline" | ||
> | ||
{event.url.text ?? 'Click here!'} | ||
</a> | ||
)} | ||
</div> | ||
</div> | ||
</FancyRectangle> | ||
); | ||
} |
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,45 @@ | ||
import { type Event } from '@/data/events'; | ||
import Image from 'next/image'; | ||
import { useState } from 'react'; | ||
import EventCard from './EventCard'; | ||
|
||
export default function EventsByYear({ | ||
year, | ||
events, | ||
isOpenDefault, | ||
isPastEvent, | ||
}: { | ||
year: number; | ||
events: Event[]; | ||
isOpenDefault: boolean; | ||
isPastEvent?: boolean; | ||
}) { | ||
const [isOpen, setIsOpen] = useState(isOpenDefault); | ||
|
||
return ( | ||
<div> | ||
{isPastEvent && ( | ||
<div | ||
className="flex cursor-pointer items-center justify-center" | ||
onClick={() => setIsOpen(!isOpen)} | ||
> | ||
<Image | ||
src="/images/yellow-triangle.svg" | ||
alt="Yellow Triangle" | ||
className={`mr-4 transition-transform duration-300 ease-in-out ${isOpen ? 'rotate-90' : 'rotate-120'}`} | ||
width={30} | ||
height={30} | ||
/> | ||
<h3 className="text-3xl font-bold md:text-4xl">{year.toString()}</h3> | ||
</div> | ||
)} | ||
{isOpen && ( | ||
<div className="mt-6 space-y-8"> | ||
{events.map((event, i) => ( | ||
<EventCard key={i} index={i} event={event} isPastEvent={isPastEvent} /> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.