-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create new option component * Naming changes * Add max height transition to tailwind * Add expanded and animation * Update option card * Install dropdown menu * Add sorting menu * Make button boxy * Current changes * Add new App.tsx from origin * Update type * Add event cards
- Loading branch information
1 parent
337753b
commit 085e804
Showing
7 changed files
with
93 additions
and
21 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
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,60 @@ | ||
import Markdown from 'react-markdown'; | ||
|
||
import { GetEventResponse } from 'api'; | ||
|
||
import { Body } from '../typography/Body.styled'; | ||
import { Subtitle } from '../typography/Subtitle.styled'; | ||
import Link from '../link'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
type EventsProps = { | ||
events: GetEventResponse[] | undefined; | ||
errorMessage: string; | ||
}; | ||
|
||
export default function Events({ events, errorMessage }: EventsProps) { | ||
const navigate = useNavigate(); | ||
|
||
const handleClick = (eventId: string) => { | ||
navigate(`/events/${eventId}/cycles`); | ||
}; | ||
|
||
return events?.length ? ( | ||
events.map((event) => { | ||
return ( | ||
<article | ||
key={event.id} | ||
className="border-secondary flex w-full cursor-pointer flex-col border" | ||
onClick={() => handleClick(event.id)} | ||
> | ||
<section className="flex flex-col gap-4 p-4"> | ||
<Subtitle>{event.name}</Subtitle> | ||
{event.description && ( | ||
<Markdown | ||
components={{ | ||
a: ({ node, ...props }) => <Link to={props.href ?? ''}>{props.children}</Link>, | ||
p: ({ node, ...props }) => ( | ||
<Body className="truncate" style={{ whiteSpace: 'nowrap' }}> | ||
{props.children} | ||
</Body> | ||
), | ||
}} | ||
> | ||
{event.description} | ||
</Markdown> | ||
)} | ||
</section> | ||
<section className="h-40 w-full"> | ||
<img | ||
className="h-full w-full object-cover object-center" | ||
src={event.imageUrl} | ||
alt={`${event.name} image`} | ||
/> | ||
</section> | ||
</article> | ||
); | ||
}) | ||
) : ( | ||
<Body>{errorMessage}</Body> | ||
); | ||
} |
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 @@ | ||
export { default } from './Events'; |
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