diff --git a/src/components/Paginator/Paginator.tsx b/src/components/Paginator/Paginator.tsx index cb61d9198..20f8f6e6b 100644 --- a/src/components/Paginator/Paginator.tsx +++ b/src/components/Paginator/Paginator.tsx @@ -10,6 +10,7 @@ interface Props extends React.HTMLAttributes { selectedPage: number; totalPages: number; maximumPagesToShow?: number; + scrollToTopOnPageChange?: boolean; onGoToPage: (page: number) => void; } @@ -57,6 +58,7 @@ export const Paginator: React.FC = ({ selectedPage, totalPages, maximumPagesToShow = defaultMaximumNumberOfPagesToShow, + scrollToTopOnPageChange = true, onGoToPage, className }: Props) => { @@ -71,7 +73,7 @@ export const Paginator: React.FC = ({ disabled={!canDoPrev(selectedPage)} onClick={() => { prevPage(selectedPage); - window.scrollTo(0, 0); + if (scrollToTopOnPageChange) window.scrollTo(0, 0); }} className={classNames('Paginator__button', 'Paginator__button--previous')} > @@ -83,7 +85,7 @@ export const Paginator: React.FC = ({