@@ -6,7 +6,13 @@ interface PaginationProps {
66 totalItems : number ;
77}
88
9- const Pagination = ( { currentPage, totalPages, onPageChange, itemsPerPage, totalItems } : PaginationProps ) => {
9+ const Pagination = ( {
10+ currentPage,
11+ totalPages,
12+ onPageChange,
13+ itemsPerPage,
14+ totalItems,
15+ } : PaginationProps ) => {
1016 const startItem = ( currentPage - 1 ) * itemsPerPage + 1 ;
1117 const endItem = Math . min ( currentPage * itemsPerPage , totalItems ) ;
1218
@@ -42,48 +48,55 @@ const Pagination = ({ currentPage, totalPages, onPageChange, itemsPerPage, total
4248 if ( totalPages <= 1 ) return null ;
4349
4450 return (
45- < div className = " flex items-center justify-between px-4 py-3 bg-white border-t border-gray-200 sm:px-6" >
46- < div className = " flex justify-between flex-1 sm:hidden" >
51+ < div className = ' flex items-center justify-between px-4 py-3 bg-white border-t border-gray-200 sm:px-6' >
52+ < div className = ' flex justify-between flex-1 sm:hidden' >
4753 < button
4854 onClick = { ( ) => onPageChange ( currentPage - 1 ) }
4955 disabled = { currentPage === 1 }
50- className = " relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
56+ className = ' relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed'
5157 >
5258 Previous
5359 </ button >
5460 < button
5561 onClick = { ( ) => onPageChange ( currentPage + 1 ) }
5662 disabled = { currentPage === totalPages }
57- className = " relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
63+ className = ' relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed'
5864 >
5965 Next
6066 </ button >
6167 </ div >
62- < div className = " hidden sm:flex sm:flex-1 sm:items-center sm:justify-between" >
68+ < div className = ' hidden sm:flex sm:flex-1 sm:items-center sm:justify-between' >
6369 < div >
64- < p className = " text-sm text-gray-700" >
65- Showing < span className = " font-medium" > { startItem } </ span > to{ ' ' }
66- < span className = " font-medium" > { endItem } </ span > of{ ' ' }
67- < span className = " font-medium" > { totalItems } </ span > results
70+ < p className = ' text-sm text-gray-700' >
71+ Showing < span className = ' font-medium' > { startItem } </ span > to{ ' ' }
72+ < span className = ' font-medium' > { endItem } </ span > of{ ' ' }
73+ < span className = ' font-medium' > { totalItems } </ span > results
6874 </ p >
6975 </ div >
7076 < div >
71- < nav className = "relative z-0 inline-flex -space-x-px rounded-md shadow-sm" aria-label = "Pagination" >
77+ < nav
78+ className = 'relative z-0 inline-flex -space-x-px rounded-md shadow-sm'
79+ aria-label = 'Pagination'
80+ >
7281 < button
7382 onClick = { ( ) => onPageChange ( currentPage - 1 ) }
7483 disabled = { currentPage === 1 }
75- className = " relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
84+ className = ' relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed'
7685 >
77- < span className = "sr-only" > Previous</ span >
78- < svg className = "w-5 h-5" fill = "currentColor" viewBox = "0 0 20 20" >
79- < path fillRule = "evenodd" d = "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clipRule = "evenodd" />
86+ < span className = 'sr-only' > Previous</ span >
87+ < svg className = 'w-5 h-5' fill = 'currentColor' viewBox = '0 0 20 20' >
88+ < path
89+ fillRule = 'evenodd'
90+ d = 'M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z'
91+ clipRule = 'evenodd'
92+ />
8093 </ svg >
8194 </ button >
8295 { getPageNumbers ( ) . map ( ( page , index ) =>
8396 page === '...' ? (
8497 < span
8598 key = { `ellipsis-${ index } ` }
86- className = " relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300"
99+ className = ' relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300'
87100 >
88101 ...
89102 </ span >
@@ -104,11 +117,15 @@ const Pagination = ({ currentPage, totalPages, onPageChange, itemsPerPage, total
104117 < button
105118 onClick = { ( ) => onPageChange ( currentPage + 1 ) }
106119 disabled = { currentPage === totalPages }
107- className = " relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
120+ className = ' relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed'
108121 >
109- < span className = "sr-only" > Next</ span >
110- < svg className = "w-5 h-5" fill = "currentColor" viewBox = "0 0 20 20" >
111- < path fillRule = "evenodd" d = "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clipRule = "evenodd" />
122+ < span className = 'sr-only' > Next</ span >
123+ < svg className = 'w-5 h-5' fill = 'currentColor' viewBox = '0 0 20 20' >
124+ < path
125+ fillRule = 'evenodd'
126+ d = 'M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z'
127+ clipRule = 'evenodd'
128+ />
112129 </ svg >
113130 </ button >
114131 </ nav >
0 commit comments