Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor(gallery)/move pagination button below pictures #1145

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
### 🎨 - Designendringer

## Neste versjon
🎨 - **Desingendring**. Sentrerte og flyttet "Last in mer" knappen under bildene i galleri.

## Versjon 2024.15.10

- ✨ **Betalinger**. Man kan nå se hvem på deltagerlisten som har betalt for arrangementet.
- 🎨 **Profil navigering**. Ikoner på mobil på profil er nå fikset.
- 🎨 **Maks bredde på tekst**. Beskrivelse under tittel er nå tilpasset.
Expand Down
14 changes: 8 additions & 6 deletions src/pages/GalleryDetails/components/GalleryRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useMemo } from 'react';

import { Gallery } from 'types';
import { Picture } from 'types';

Check warning on line 4 in src/pages/GalleryDetails/components/GalleryRenderer.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

'Picture' is defined but never used

Check warning on line 4 in src/pages/GalleryDetails/components/GalleryRenderer.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

'Picture' is defined but never used

import { useGalleryPictures } from 'hooks/Gallery';

Expand All @@ -26,13 +27,14 @@
const GalleryRenderer = ({ id }: GalleryRendererProps) => {
const { data, hasNextPage, fetchNextPage, isFetching } = useGalleryPictures(id);
const pictures = useMemo(() => (data ? data.pages.map((page) => page.results).flat() : []), [data]);

return (
<div className='grid md:grid-cols-2 lg:grid-cols-3 gap-4'>
{pictures.map((image) => (
<PictureDialog galleryId={id} key={image.id} picture={image} />
))}
{hasNextPage && <PaginateButton className='w-full mt-4' isLoading={isFetching} nextPage={fetchNextPage} />}
<div className='flex flex-col justify-center items-center'>
<div className='grid md:grid-cols-2 lg:grid-cols-3 gap-4'>
{pictures.map((image) => (
<PictureDialog galleryId={id} key={image.id} picture={image} />
))}
</div>
{hasNextPage && <PaginateButton className='mt-4' isLoading={isFetching} nextPage={fetchNextPage} />}
</div>
);
};
Expand Down
Loading