blob: 14b093b74e295c959139485aa2f6133c23207458 [file] [log] [blame]
Krishyab5ef96d2025-06-05 13:57:05 +08001import React from 'react';
2import { useGroupStore } from '../../context/useGroupStore';
3
4const GroupPagination = () => {
5 const { page, totalPages, setPage } = useGroupStore();
6
7 const handlePrevPage = () => {
8 if (page > 1) setPage(page - 1);
9 };
10
11 const handleNextPage = () => {
12 if (page < totalPages) setPage(page + 1);
13 };
14
15 return (
16 <div className="pagination">
17 <button onClick={handlePrevPage} disabled={page <= 1}>
18 上一页
19 </button>
20 <span> {page} / {totalPages} 页</span>
21 <button onClick={handleNextPage} disabled={page >= totalPages}>
22 下一页
23 </button>
24 </div>
25 );
26};
27
28export default GroupPagination;