5
5
*/
6
6
7
7
import { getPaginationNumbers } from "./getPagination" ;
8
- import Arrow from "../components/Arrow " ;
8
+ import PaginationNavigationButton from "./PaginationNavigationButton " ;
9
9
10
10
interface PaginationProps {
11
11
totalNumberOfPages : number ;
@@ -29,23 +29,23 @@ function Pagination(props: PaginationProps) {
29
29
} ;
30
30
const getClassnames = ( pageNumber : string | number ) => {
31
31
if ( pageNumber === currentPage ) {
32
- return "text-gray-500 w-8 text -center rounded-md hover:bg-gray-50 bg-gray-100 disabled pointer-events-none" ;
32
+ return "font-semibold text-gray-500 dark:text-gray-400 max-h-9 max- w-8 flex items -center justify-center rounded-md hover:bg-gray-50 dark:hover: bg-gray-800 dark:bg-gray-700 bg-gray- 100 disabled pointer-events-none px-3 py-2 " ;
33
33
}
34
34
if ( pageNumber === "..." ) {
35
- return "text-gray-500 w-8 text -center rounded-md hover:bg-gray-50 disabled pointer-events-none" ;
35
+ return "font-semibold text-gray-500 dark:text-gray-400 max-h-9 max- w-8 flex items -center justify-center rounded-md hover:bg-gray-50 dark:hover:bg-gray-800 disabled pointer-events-none px-3 py-2 " ;
36
36
}
37
- return "text-gray-500 w-8 text -center rounded-md hover:bg-gray-50 cursor-pointer" ;
37
+ return "font-semibold text-gray-500 dark:text-gray-400 max-h-9 max- w-8 flex items -center justify-center rounded-md hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer px-3 py-2 " ;
38
38
} ;
39
39
40
40
return (
41
41
< nav className = "mt-16 mb-16" >
42
- < ul className = "flex justify-center space-x-4" >
43
- < li className = { `text-gray-400 ${ currentPage === 1 ? "disabled" : "cursor-pointer text-gray-500" } ` } >
44
- < span onClick = { prevPage } >
45
- < Arrow direction = { "left" } />
46
- Previous
47
- </ span >
48
- </ li >
42
+ < ul className = "flex justify-center items-center space-x-4" >
43
+ < PaginationNavigationButton
44
+ isDisabled = { currentPage === 1 }
45
+ onClick = { prevPage }
46
+ label = { " Previous" }
47
+ arrowDirection = { "left" }
48
+ / >
49
49
{ calculatedPagination . map ( ( pn , i ) => {
50
50
if ( pn === "..." ) {
51
51
return < li className = { getClassnames ( pn ) } > …</ li > ;
@@ -56,16 +56,12 @@ function Pagination(props: PaginationProps) {
56
56
</ li >
57
57
) ;
58
58
} ) }
59
- < li
60
- className = { `text-gray-400 ${
61
- currentPage === totalNumberOfPages ? "disabled" : "cursor-pointer text-gray-500"
62
- } `}
63
- >
64
- < span onClick = { nextPage } >
65
- Next
66
- < Arrow direction = { "right" } />
67
- </ span >
68
- </ li >
59
+ < PaginationNavigationButton
60
+ isDisabled = { currentPage === totalNumberOfPages }
61
+ onClick = { nextPage }
62
+ label = { "Next" }
63
+ arrowDirection = { "right" }
64
+ />
69
65
</ ul >
70
66
</ nav >
71
67
) ;
0 commit comments