@@ -20,7 +20,7 @@ export default function Pagination({total = 0, perPage = 10, onChange = () => {}
2020
2121 const renderPageNumbers = ( ) => {
2222 const pages = [ ] ;
23- const maxVisible = 5 ;
23+ const maxVisible = window . innerWidth < 640 ? 3 : 5 ;
2424 let startPage = Math . max ( 1 , safePage - Math . floor ( maxVisible / 2 ) ) ;
2525 let endPage = Math . min ( pagesCount , startPage + maxVisible - 1 ) ;
2626
@@ -34,7 +34,7 @@ export default function Pagination({total = 0, perPage = 10, onChange = () => {}
3434 type = "button"
3535 key = { 1 }
3636 onClick = { ( ) => onChange ( 1 ) }
37- className = "px-3 py-2 mx-1 text-sm rounded-md bg-white border border-gray-300 hover:bg-gray-50"
37+ className = "px-2 sm:px- 3 py-2 mx-0.5 sm:mx- 1 text-xs sm:text-sm rounded-md bg-white border border-gray-300 hover:bg-gray-50 whitespace-nowrap "
3838 >
3939 1
4040 </ button >
@@ -54,7 +54,7 @@ export default function Pagination({total = 0, perPage = 10, onChange = () => {}
5454 type = "button"
5555 key = { i }
5656 onClick = { ( ) => onChange ( i ) }
57- className = { `px-3 py-2 mx-1 text-sm rounded-md ${
57+ className = { `px-2 sm:px- 3 py-2 mx-0.5 sm:mx- 1 text-xs sm:text-sm rounded-md whitespace-nowrap ${
5858 i === safePage
5959 ? 'bg-blue-600 text-white border border-blue-600'
6060 : 'bg-white border border-gray-300 hover:bg-gray-50'
@@ -78,7 +78,7 @@ export default function Pagination({total = 0, perPage = 10, onChange = () => {}
7878 type = "button"
7979 key = { pagesCount }
8080 onClick = { ( ) => onChange ( pagesCount ) }
81- className = "px-3 py-2 mx-1 text-sm rounded-md bg-white border border-gray-300 hover:bg-gray-50"
81+ className = "px-2 sm:px- 3 py-2 mx-0.5 sm:mx- 1 text-xs sm:text-sm rounded-md bg-white border border-gray-300 hover:bg-gray-50 whitespace-nowrap "
8282 >
8383 { pagesCount }
8484 </ button >
@@ -90,13 +90,13 @@ export default function Pagination({total = 0, perPage = 10, onChange = () => {}
9090
9191 return (
9292 < >
93- < div className = "flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-6 mt-6 flex-wrap" >
94- < div className = "flex items-center space-x-2 " >
93+ < div className = "flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-6 mt-6 flex-wrap px-4 " >
94+ < div className = "flex items-center space-x-1 sm:space-x-2 overflow-x-auto max-w-full " >
9595 < button
9696 type = "button"
9797 onClick = { ( ) => onChange ( 1 ) }
9898 disabled = { safePage === 1 }
99- className = "p-2 rounded-md bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
99+ className = "p-1.5 sm:p- 2 rounded-md bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
100100 >
101101 < ChevronLeftIcon className = "w-4 h-4" />
102102 </ button >
@@ -105,7 +105,7 @@ export default function Pagination({total = 0, perPage = 10, onChange = () => {}
105105 type = "button"
106106 onClick = { ( ) => onChange ( safePage - 1 ) }
107107 disabled = { safePage === 1 }
108- className = "p-2 rounded-md bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
108+ className = "p-1.5 sm:p- 2 rounded-md bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
109109 >
110110 < ChevronLeftIcon className = "w-4 h-4" />
111111 </ button >
@@ -116,7 +116,7 @@ export default function Pagination({total = 0, perPage = 10, onChange = () => {}
116116 type = "button"
117117 onClick = { ( ) => onChange ( safePage + 1 ) }
118118 disabled = { safePage === pagesCount }
119- className = "p-2 rounded-md bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
119+ className = "p-1.5 sm:p- 2 rounded-md bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
120120 >
121121 < ChevronRightIcon className = "w-4 h-4" />
122122 </ button >
@@ -125,7 +125,7 @@ export default function Pagination({total = 0, perPage = 10, onChange = () => {}
125125 type = "button"
126126 onClick = { ( ) => onChange ( pagesCount ) }
127127 disabled = { safePage === pagesCount }
128- className = "p-2 rounded-md bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
128+ className = "p-1.5 sm:p- 2 rounded-md bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
129129 >
130130 < ChevronRightIcon className = "w-4 h-4" />
131131 </ button >
@@ -144,7 +144,7 @@ export default function Pagination({total = 0, perPage = 10, onChange = () => {}
144144 type = "button"
145145 onClick = { ( ) => onChange ( newPage ) }
146146 disabled = { newPage === 0 }
147- className = "p-2 rounded-md bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
147+ className = "p-1.5 sm:p- 2 rounded-md bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
148148 >
149149 < ChevronRightIcon className = "w-4 h-4" />
150150 </ button >
0 commit comments