Skip to content

Commit

Permalink
Adding placeholder image for the events
Browse files Browse the repository at this point in the history
  • Loading branch information
amankumarrr committed Oct 31, 2024
1 parent 5ab3ed2 commit f4918e6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
8 changes: 5 additions & 3 deletions app/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Container } from "@/components/util/container";

export default function Loading() {
const Loading = () => (
<Container className="flex justify-center" width="large" size="custom">
<h1>Loading...</h1>
</Container>;
}
</Container>
);

export default Loading;
13 changes: 12 additions & 1 deletion components/filter/events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ const Event = ({ visible, event, jsonLd }: EventProps) => {
}

const { formattedDate, relativeDate } = useFormatDates(event, true);
const [bannerLoaded, setBannerLoaded] = useState(false);
return (
<>
<Transition
Expand All @@ -314,13 +315,23 @@ const Event = ({ visible, event, jsonLd }: EventProps) => {
>
<div className="mb-8 flex max-md:flex-col md:flex-row">
<div className="mr-3 shrink-0">
{!bannerLoaded && (
<Image
className="rounded-md max-md:pb-3"
height={100}
width={100}
alt={`${event.thumbnailDescription || event.title} placeholder`}
src="/event_placeholder.png"
/>
)}
<Image
className="rounded-md max-md:pb-3"
className={`rounded-md max-md:pb-3 ${bannerLoaded ? "" : "invisible h-0"}`}
height={100}
width={100}
alt={`${event.thumbnailDescription || event.title} logo`}
src={thumbnail}
onError={handleImageError}
onLoad={() => setBannerLoaded(true)}
/>
</div>
<div>
Expand Down
Binary file added public/event_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f4918e6

Please sign in to comment.