Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Center Pagination Component
Browse files Browse the repository at this point in the history
  • Loading branch information
kkamara committed Oct 22, 2024
1 parent 28be6d2 commit e233886
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
43 changes: 23 additions & 20 deletions resources/js/components/pages/HomeComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,28 @@ export default function HomeComponent() {
return null
}

return <ReactPaginate
onPageChange={handlePageChange}
previousLabel="Previous"
nextLabel="Next"
pageClassName="page-item"
pageLinkClassName="page-link"
previousClassName="page-item"
previousLinkClassName="page-link"
nextClassName="page-item"
nextLinkClassName="page-link"
breakLabel="..."
breakClassName="page-item"
breakLinkClassName="page-link"
pageCount={state.home.data.meta.last_page}
marginPagesDisplayed={2}
pageRangeDisplayed={5}
containerClassName="pagination"
activeClassName="active"
forcePage={state.home.data.meta.current_page - 1}
/>
return <div className="book-pagination">
<ReactPaginate
onPageChange={handlePageChange}
previousLabel="Previous"
nextLabel="Next"
pageClassName="page-item"
pageLinkClassName="page-link"
previousClassName="page-item"
previousLinkClassName="page-link"
nextClassName="page-item"
nextLinkClassName="page-link"
breakLabel="..."
breakClassName="page-item"
breakLinkClassName="page-link"
pageCount={state.home.data.meta.last_page}
marginPagesDisplayed={2}
pageRangeDisplayed={5}
containerClassName="pagination"
activeClassName="active"
forcePage={state.home.data.meta.current_page - 1}
/>
</div>
}

const paginationDetail = () => {
Expand All @@ -69,6 +71,7 @@ export default function HomeComponent() {
}
return (
<>
{paginationDetail()}
<div className="col-md-12">
{state.home.data.data.map((book, index) => (
<div key={index} className="card home-card">
Expand Down
5 changes: 5 additions & 0 deletions resources/js/components/pages/HomeComponent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@
.book-cost {
font-size: 18px;
font-weight: 700;
}

.book-pagination {
display: flex;
justify-content: center;
}

0 comments on commit e233886

Please sign in to comment.