-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
169 additions
and
188 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 |
---|---|---|
@@ -1,93 +1,79 @@ | ||
import Link from 'next/link' | ||
import Link from 'next/link'; | ||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardHeader, | ||
CardTitle, | ||
} from '@/components/ui/card' | ||
|
||
interface Event { | ||
_id: string | ||
name: string | ||
description: string | ||
start: string | ||
end: string | ||
logo: string | ||
eventCover: string | ||
location: string | ||
slug: string | ||
website: string | ||
organizationId: string | ||
} | ||
|
||
interface Organization { | ||
_id: string | ||
name: string | ||
slug: string | ||
} | ||
} from '@/components/ui/card'; | ||
import Image from 'next/image'; | ||
import { IExtendedEvent, IExtendedOrganization } from '@/lib/types'; | ||
|
||
interface FeaturedEventsProps { | ||
events: Event[] | ||
organizations: { [key: string]: Organization } | ||
events: IExtendedEvent[]; | ||
organizations: { [key: string]: IExtendedOrganization }; | ||
} | ||
|
||
const FeaturedEvents: React.FC<FeaturedEventsProps> = ({ | ||
events, | ||
organizations, | ||
}) => { | ||
return ( | ||
<div className="grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-4"> | ||
<div className="grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3"> | ||
{events.map((event, index) => { | ||
const org = organizations[event.organizationId] | ||
const eventUrl = `https://streameth.org/${org.slug}` | ||
const org = organizations[event.organizationId]; | ||
const eventUrl = `https://streameth.org/${org.slug}`; | ||
|
||
return ( | ||
<Link | ||
href={eventUrl} | ||
key={event._id} | ||
target="_blank" | ||
rel="noopener noreferrer"> | ||
rel="noopener noreferrer" | ||
> | ||
<Card | ||
className="flex h-full flex-col overflow-hidden duration-300 ease-out hover:scale-105" | ||
style={{ animationDelay: `${index * 150}ms` }}> | ||
<CardHeader className="flex-shrink-0 p-0"> | ||
<img | ||
className="relative flex h-full flex-col overflow-hidden duration-300 ease-out hover:scale-105" | ||
style={{ animationDelay: `${index * 150}ms` }} | ||
> | ||
<CardHeader className="flex-shrink-0 p-0 md:p-0 lg:p-0"> | ||
<Image | ||
src={ | ||
event.eventCover || | ||
event.logo || | ||
'https://via.placeholder.com/300x200' | ||
event.eventCover || 'https://via.placeholder.com/300x200' | ||
} | ||
className="aspect-video w-full" | ||
alt={event.name} | ||
className="h-48 w-full object-cover" | ||
width={300} | ||
height={200} | ||
/> | ||
</CardHeader> | ||
<CardContent className="flex flex-grow flex-col p-5"> | ||
<CardTitle className="mb-2 line-clamp-2 text-xl font-bold"> | ||
{event.name} | ||
</CardTitle> | ||
<CardDescription className="mb-2"> | ||
{new Date(event.start).toLocaleDateString()} -{' '} | ||
{new Date(event.end).toLocaleDateString()} | ||
</CardDescription> | ||
<CardDescription className="mb-2"> | ||
{event.location} | ||
</CardDescription> | ||
{org && ( | ||
<div className="absolute bottom-0"> | ||
<CardContent className="flex flex-grow flex-col p-5"> | ||
<CardTitle className="mb-2 line-clamp-2 text-xl font-bold"> | ||
{event.name} | ||
</CardTitle> | ||
<CardDescription className="mb-2"> | ||
Organized by: {org.name} | ||
{new Date(event.start).toLocaleDateString()} -{' '} | ||
{new Date(event.end).toLocaleDateString()} | ||
</CardDescription> | ||
)} | ||
<CardDescription className="mt-auto line-clamp-3"> | ||
{event.description} | ||
</CardDescription> | ||
</CardContent> | ||
<CardDescription className="mb-2"> | ||
{event.location} | ||
</CardDescription> | ||
{org && ( | ||
<CardDescription className="mb-2"> | ||
Organized by: {org.name} | ||
</CardDescription> | ||
)} | ||
<CardDescription className="mt-auto line-clamp-3"> | ||
{event.description} | ||
</CardDescription> | ||
</CardContent> | ||
</div> | ||
</Card> | ||
</Link> | ||
) | ||
); | ||
})} | ||
</div> | ||
) | ||
} | ||
); | ||
}; | ||
|
||
export default FeaturedEvents | ||
export default FeaturedEvents; |
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.