물건 페이징 컴포넌트 커서 보완
This commit is contained in:
parent
41d2f79675
commit
aef7cafc1b
@ -12,10 +12,12 @@ export default function QPagination(props) {
|
|||||||
return (
|
return (
|
||||||
<ol className="pagination">
|
<ol className="pagination">
|
||||||
<li className="page-item first">
|
<li className="page-item first">
|
||||||
<button onClick={() => handlePage(1)}></button>
|
<button type="button" disabled={currentPage === 1} onClick={() => handlePage(1)}></button>
|
||||||
</li>
|
</li>
|
||||||
<li className="page-item prev">
|
<li className="page-item prev">
|
||||||
<button
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={currentPage <= 1}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (currentPage === 1) return
|
if (currentPage === 1) return
|
||||||
handlePage(Math.max(1, (pageGroup - 2) * pagePerBlock + 1))
|
handlePage(Math.max(1, (pageGroup - 2) * pagePerBlock + 1))
|
||||||
@ -24,11 +26,15 @@ export default function QPagination(props) {
|
|||||||
</li>
|
</li>
|
||||||
{pageRange.map((page) => (
|
{pageRange.map((page) => (
|
||||||
<li className={page === currentPage ? `page-item on` : `page-item`} key={page}>
|
<li className={page === currentPage ? `page-item on` : `page-item`} key={page}>
|
||||||
<button onClick={() => handlePage(page)}>{page}</button>
|
<button type="button" onClick={() => handlePage(page)}>
|
||||||
|
{page}
|
||||||
|
</button>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
<li className="page-item next">
|
<li className="page-item next">
|
||||||
<button
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={currentPage >= totalPages}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (currentPage === totalPages) return
|
if (currentPage === totalPages) return
|
||||||
if (pageGroup * pagePerBlock + 1 <= totalPages) handlePage(Math.max(1, pageGroup * pagePerBlock + 1))
|
if (pageGroup * pagePerBlock + 1 <= totalPages) handlePage(Math.max(1, pageGroup * pagePerBlock + 1))
|
||||||
@ -36,7 +42,7 @@ export default function QPagination(props) {
|
|||||||
></button>
|
></button>
|
||||||
</li>
|
</li>
|
||||||
<li className="page-item last">
|
<li className="page-item last">
|
||||||
<button onClick={() => handlePage(totalPages)}></button>
|
<button type="button" disabled={currentPage === totalPages} onClick={() => handlePage(totalPages)}></button>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user