Skip to content

Commit

Permalink
feat: Add loading to events page
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroWave022 committed Oct 27, 2024
1 parent 84acf43 commit b2fa718
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/app/[locale]/(default)/events/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { EventCardSkeleton } from '@/components/events/EventCardSkeleton';

export default function EventsSkeleton() {
return (
<>
<h1 className='my-4'>Events</h1>
<h2 className='my-2'>Active events</h2>
<EventCardSkeleton />
<h2 className='my-4'>Upcoming events</h2>
<div className='grid grid-cols-2 gap-2'>
<EventCardSkeleton />
<EventCardSkeleton />
<EventCardSkeleton />
<EventCardSkeleton />
</div>
<h2 className='my-4'>Past events</h2>
<div className='grid grid-cols-2 gap-2'>
<EventCardSkeleton />
<EventCardSkeleton />
<EventCardSkeleton />
<EventCardSkeleton />
</div>
</>
);
}
37 changes: 37 additions & 0 deletions src/components/events/EventCardSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from '@/components/ui/Card';

import { Avatar, AvatarImage } from '@/components/ui/Avatar';
import { cx } from '@/lib/utils';
import { Skeleton } from '../ui/Skeleton';

/**
* A card for an event.
* Only set the _active prop to true if you're testing active events.
*/
function EventCardSkeleton() {
return (
<Card className={cx('text-center')}>
<CardHeader>
<Skeleton className='mx-auto h-8 w-3/4' />
<Skeleton className='mx-auto h-5 w-1/2' />
</CardHeader>
<CardContent className='grid grid-cols-10 gap-2'>
<Skeleton className='col-span-6 h-3/4 w-ful flex-1' />
<Skeleton className='col-span-4 ml-auto h-48 w-48 rounded-full' />
</CardContent>
<CardFooter className='flex-col gap-2'>
<Skeleton className='h-5 w-56' />
<Skeleton className='h-5 w-52' />
</CardFooter>
</Card>
);
}

export { EventCardSkeleton };

0 comments on commit b2fa718

Please sign in to comment.