Pagination improvments.

This commit is contained in:
n8detar 2022-04-21 12:02:03 -07:00
parent d948b3e8e7
commit bcfd89be02

View File

@ -384,22 +384,15 @@ const Download: NextPage = () => {
<a key={`${page}`} className="pagination-item" onClick={() => handleSetPageNumber(page)}>{page}</a> <a key={`${page}`} className="pagination-item" onClick={() => handleSetPageNumber(page)}>{page}</a>
)}) )})
} }
{downloads?.paginate?.prev_pages && {pageNumber != 1 && <span> &lt; </span> }
<span>&lt; </span>
}
<span> Page {pageNumber}</span> <span> Page {pageNumber}</span>
{downloads?.paginate?.next_pages && {downloads?.paginate?.last_page && <span> &gt; </span> }
<span> &gt; </span>
}
{downloads?.paginate?.next_pages && {downloads?.paginate?.next_pages &&
downloads?.paginate?.next_pages?.map((page) => { downloads?.paginate?.next_pages?.map((page) => {
return ( return (
<a key={`${page}`} className="pagination-item" onClick={() => handleSetPageNumber(page)}>{page}</a> <a key={`${page}`} className="pagination-item" onClick={() => handleSetPageNumber(page)}>{page}</a>
)}) )})
} }
{downloads?.paginate?.next_pages?.forEach((page) =>
<a className="pagination-item" onClick={() => handleSetPageNumber(page)}>{page}</a>
)}
{downloads?.paginate?.last_page && {downloads?.paginate?.last_page &&
<a className="pagination-item" onClick={() => handleSetPageNumber(downloads?.paginate?.last_page)}> Last ({downloads?.paginate?.last_page}) </a> <a className="pagination-item" onClick={() => handleSetPageNumber(downloads?.paginate?.last_page)}> Last ({downloads?.paginate?.last_page}) </a>
} }