Update documentation of pagination methods

This commit is contained in:
Alexander Navarro 2023-11-11 10:01:03 -03:00
parent e593354cb4
commit deb95b355f

View file

@ -8,6 +8,12 @@ interface Page {
export interface IUsePagination<T> {
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<T>({
});
};
/** 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<T>({
return { page, current: page === currentPage };
},
);
};
}
return {
changeOffset,