From deb95b355f75fd3d86ebf746640cf7ba58990596 Mon Sep 17 00:00:00 2001 From: aleidk Date: Sat, 11 Nov 2023 10:01:03 -0300 Subject: [PATCH] Update documentation of pagination methods --- src/hooks/usePagination.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/hooks/usePagination.tsx b/src/hooks/usePagination.tsx index 7911fa4..a0e0c21 100644 --- a/src/hooks/usePagination.tsx +++ b/src/hooks/usePagination.tsx @@ -8,6 +8,12 @@ interface Page { export interface IUsePagination { items: T[]; changeOffset: (offset: Offset, newValue?: number) => void; + /** + * Returns an array with the aviables pages to directly navigate. + * This pages are centered in the current page and offest to 5 items to each side. + + * @returns {Page} + */ getPaginationRange: () => Page[]; } @@ -89,10 +95,7 @@ export default function usePagination({ }); }; - /** Returns an array with the aviables pages to directly navigate. - * This pages are centered in the current page and offest to 5 items to each side. - */ - const getPaginationRange = (): Page[] => { + function getPaginationRange(): Page[] { // NOTE: this is made to work with uneven numbers, // So the current page is always aligned in the center. const paginationToSides = 5; @@ -111,7 +114,7 @@ export default function usePagination({ return { page, current: page === currentPage }; }, ); - }; + } return { changeOffset,