-
-
Notifications
You must be signed in to change notification settings - Fork 477
Expand file tree
/
Copy pathPagination.jsx
More file actions
42 lines (38 loc) · 1.07 KB
/
Pagination.jsx
File metadata and controls
42 lines (38 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React from 'react';
function Pagination({ currentPage, totalPages, onNextPage, onPrevPage }) {
const handlePrevPage = () => {
if (currentPage > 1) {
onPrevPage();
}
};
const handleNextPage = () => {
if (currentPage < totalPages) {
onNextPage();
}
};
return (
<div className="mb-5 flex items-center justify-end gap-12">
<button onClick={handlePrevPage} disabled={currentPage === 1} className="focus:outline-none disabled:opacity-30">
<span
href="#"
className="font-spaceMono hover:text-textSecondary dark:text-white dark:hover:text-textSecondary"
>
Previous
</span>
</button>
<button
onClick={handleNextPage}
disabled={currentPage === totalPages}
className="focus:outline-none disabled:opacity-30"
>
<span
href="#"
className="font-spaceMono hover:text-textSecondary dark:text-white dark:hover:text-textSecondary"
>
Next
</span>
</button>
</div>
);
}
export default Pagination;