|
1 | 1 | 'use client'; |
2 | 2 |
|
3 | 3 | import React from 'react'; |
4 | | -import { Button, Select, Space, Typography } from 'antd'; |
5 | | -import { LeftOutlined, RightOutlined } from '@ant-design/icons'; |
| 4 | +import { Button } from '@/components/ui/button'; |
| 5 | +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; |
| 6 | +import { ChevronLeft, ChevronRight } from 'lucide-react'; |
6 | 7 | import { PaginationMeta } from '@codervisor/devlog-core'; |
7 | 8 |
|
8 | | -const { Text } = Typography; |
9 | | -const { Option } = Select; |
10 | | - |
11 | 9 | interface PaginationProps { |
12 | 10 | pagination: PaginationMeta; |
13 | 11 | onPageChange: (page: number) => void; |
@@ -65,73 +63,75 @@ export function Pagination({ |
65 | 63 | return ( |
66 | 64 | <div className={`flex items-center justify-between gap-4 ${className || ''}`}> |
67 | 65 | {/* Results info */} |
68 | | - <Text type="secondary" className="text-sm"> |
| 66 | + <p className="text-sm text-muted-foreground"> |
69 | 67 | Showing {startItem}-{endItem} of {total} results |
70 | | - </Text> |
| 68 | + </p> |
71 | 69 |
|
72 | | - <Space size="middle" className="flex items-center"> |
| 70 | + <div className="flex items-center gap-4"> |
73 | 71 | {/* Page size selector */} |
74 | 72 | {showSizeChanger && ( |
75 | | - <Space size="small"> |
76 | | - <Text type="secondary" className="text-sm"> |
77 | | - Show |
78 | | - </Text> |
79 | | - <Select value={limit} onChange={onPageSizeChange} size="small" style={{ width: 70 }}> |
80 | | - {pageSizeOptions.map((size) => ( |
81 | | - <Option key={size} value={size}> |
82 | | - {size} |
83 | | - </Option> |
84 | | - ))} |
| 73 | + <div className="flex items-center gap-2"> |
| 74 | + <span className="text-sm text-muted-foreground">Show</span> |
| 75 | + <Select value={limit.toString()} onValueChange={(value) => onPageSizeChange(parseInt(value))}> |
| 76 | + <SelectTrigger className="w-16"> |
| 77 | + <SelectValue /> |
| 78 | + </SelectTrigger> |
| 79 | + <SelectContent> |
| 80 | + {pageSizeOptions.map((size) => ( |
| 81 | + <SelectItem key={size} value={size.toString()}> |
| 82 | + {size} |
| 83 | + </SelectItem> |
| 84 | + ))} |
| 85 | + </SelectContent> |
85 | 86 | </Select> |
86 | | - <Text type="secondary" className="text-sm"> |
87 | | - per page |
88 | | - </Text> |
89 | | - </Space> |
| 87 | + <span className="text-sm text-muted-foreground">per page</span> |
| 88 | + </div> |
90 | 89 | )} |
91 | 90 |
|
92 | 91 | {/* Page navigation */} |
93 | | - <Space size="small"> |
| 92 | + <div className="flex items-center gap-1"> |
94 | 93 | <Button |
95 | | - icon={<LeftOutlined />} |
| 94 | + variant="outline" |
| 95 | + size="sm" |
96 | 96 | disabled={!hasPreviousPage} |
97 | 97 | onClick={() => onPageChange(page - 1)} |
98 | | - size="small" |
99 | 98 | > |
| 99 | + <ChevronLeft className="h-4 w-4 mr-1" /> |
100 | 100 | Previous |
101 | 101 | </Button> |
102 | 102 |
|
103 | 103 | {/* Page numbers */} |
104 | | - <Space size={4}> |
| 104 | + <div className="flex items-center gap-1"> |
105 | 105 | {getVisiblePages().map((pageNum, index) => |
106 | 106 | pageNum === '...' ? ( |
107 | | - <span key={`dots-${index}`} className="px-2 text-gray-400"> |
| 107 | + <span key={`dots-${index}`} className="px-2 text-muted-foreground"> |
108 | 108 | ... |
109 | 109 | </span> |
110 | 110 | ) : ( |
111 | 111 | <Button |
112 | 112 | key={pageNum} |
113 | | - type={pageNum === page ? 'primary' : 'default'} |
| 113 | + variant={pageNum === page ? 'default' : 'outline'} |
| 114 | + size="sm" |
114 | 115 | onClick={() => onPageChange(pageNum as number)} |
115 | | - size="small" |
116 | 116 | className="min-w-8" |
117 | 117 | > |
118 | 118 | {pageNum} |
119 | 119 | </Button> |
120 | 120 | ), |
121 | 121 | )} |
122 | | - </Space> |
| 122 | + </div> |
123 | 123 |
|
124 | 124 | <Button |
125 | | - iconPosition="end" |
126 | | - icon={<RightOutlined />} |
| 125 | + variant="outline" |
| 126 | + size="sm" |
127 | 127 | disabled={!hasNextPage} |
128 | 128 | onClick={() => onPageChange(page + 1)} |
129 | | - size="small" |
130 | 129 | > |
131 | 130 | Next |
| 131 | + <ChevronRight className="h-4 w-4 ml-1" /> |
132 | 132 | </Button> |
133 | | - </Space> |
134 | | - </Space> |
| 133 | + </div> |
| 134 | + </div> |
135 | 135 | </div> |
136 | 136 | ); |
137 | 137 | } |
0 commit comments