From 6dcad6225b797e4c536097a7e7d6d8456f91a258 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Tue, 19 Jul 2022 14:16:20 -0600 Subject: [PATCH] Next/Previous => Older/Newer --- web/components/pagination.tsx | 30 +++++++++++++++++++++--------- web/pages/notifications.tsx | 2 ++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/web/components/pagination.tsx b/web/components/pagination.tsx index a585985d..069ebda7 100644 --- a/web/components/pagination.tsx +++ b/web/components/pagination.tsx @@ -4,8 +4,18 @@ export function Pagination(props: { totalItems: number setPage: (page: number) => void scrollToTop?: boolean + nextTitle?: string + prevTitle?: string }) { - const { page, itemsPerPage, totalItems, setPage, scrollToTop } = props + const { + page, + itemsPerPage, + totalItems, + setPage, + scrollToTop, + nextTitle, + prevTitle, + } = props const maxPage = Math.ceil(totalItems / itemsPerPage) - 1 @@ -25,19 +35,21 @@ export function Pagination(props: {

- page > 0 && setPage(page - 1)} - > - Previous - + {page > 0 && ( + page > 0 && setPage(page - 1)} + > + {prevTitle ?? 'Previous'} + + )} page < maxPage && setPage(page + 1)} > - Next + {nextTitle ?? 'Next'}
diff --git a/web/pages/notifications.tsx b/web/pages/notifications.tsx index a45bf030..7867e197 100644 --- a/web/pages/notifications.tsx +++ b/web/pages/notifications.tsx @@ -205,6 +205,8 @@ function NotificationsList(props: { totalItems={allGroupedNotifications.length} setPage={setPage} scrollToTop + nextTitle={'Older'} + prevTitle={'Newer'} /> )}