feat(tenders): scroll to top on pagination change
continuous-integration/drone/push Build is passing

Smoothly scroll the page to the top when users move between tender list pages, respecting reduced-motion preferences.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
AmirReza Jamali
2026-07-13 16:14:33 +03:30
parent b87cf35f08
commit 5155c42146
@@ -384,7 +384,7 @@ const useTenderListPresenter = () => {
const { const {
pagination, pagination,
handlePaginationChange, handlePaginationChange: changePaginationPage,
buildFirstPageParams, buildFirstPageParams,
hasNext, hasNext,
hasPrevious, hasPrevious,
@@ -396,6 +396,22 @@ const useTenderListPresenter = () => {
error, error,
}); });
const handlePaginationChange = useCallback(
(event: { selected: number }) => {
if (typeof window !== "undefined") {
const reduceMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)",
).matches;
window.scrollTo({
top: 0,
behavior: reduceMotion ? "auto" : "smooth",
});
}
changePaginationPage(event);
},
[changePaginationPage],
);
const shouldShowPagination = !isPending && (hasPrevious || hasNext); const shouldShowPagination = !isPending && (hasPrevious || hasNext);
const tendersList = data?.data?.tenders ?? []; const tendersList = data?.data?.tenders ?? [];