Skip to content

Commit

Permalink
feat: new design fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ImenOuidou committed Oct 26, 2023
1 parent 0d41278 commit 6ecaddb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const EstablishmentTable = ({ etablissements, entreprise }) => {
currentPage={currentPage}
totalPages={totalPages}
handlePageClick={handlePageClick}
displayButtons
/>
</div>
)}{" "}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import React from "react";
import LeftArrow from "../../../../shared/Icons/LeftArrow.jsx";
import RightArrow from "../../../../shared/Icons/RightArrow.jsx";

const PaginationTable = ({ currentPage, totalPages, handlePageClick }) => {
const PaginationTable = ({
currentPage,
displayButtons = false,
totalPages,
handlePageClick,
}) => {
const renderPaginationButtons = () => {
const buttons = [];
const firstPage = 1;
Expand Down Expand Up @@ -59,28 +64,33 @@ const PaginationTable = ({ currentPage, totalPages, handlePageClick }) => {
};
return (
<div className="table-pagination">
<button
className="prev-btn"
disabled={currentPage === 1}
onClick={() => handlePageClick(currentPage - 1)}
>
<LeftArrow />
Précédent
</button>
{displayButtons && (
<button
className="prev-btn"
disabled={currentPage === 1}
onClick={() => handlePageClick(currentPage - 1)}
>
<LeftArrow />
Précédent
</button>
)}
{renderPaginationButtons()}
<button
className="prev-btn"
disabled={currentPage === totalPages}
onClick={() => handlePageClick(currentPage + 1)}
>
Suivant
<RightArrow />
</button>
{displayButtons && (
<button
className="prev-btn"
disabled={currentPage === totalPages}
onClick={() => handlePageClick(currentPage + 1)}
>
Suivant
<RightArrow />
</button>
)}
</div>
);
};
PaginationTable.propTypes = {
currentPage: PropTypes.number.isRequired,
displayButtons: PropTypes.bool,
handlePageClick: PropTypes.func.isRequired,
totalPages: PropTypes.string.isRequired,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import PropTypes from "prop-types";
import React from "react";
import { withRouter } from "react-router";

import PaginationTable from "../DataSheets/Sections/SharedComponents/PaginationTable/PaginationTable.jsx";
import LeftArrow from "../shared/Icons/LeftArrow.jsx";
import RightArrow from "../shared/Icons/RightArrow.jsx";
import LoadSpinner from "../shared/LoadSpinner";
import Pager from "./Pager";

const SearchAwesomeTable = ({
showPagination = false,
Expand Down Expand Up @@ -83,10 +83,10 @@ const SearchAwesomeTable = ({
<LeftArrow />
{prevText}
</button>
<Pager
handlePageChange={pagination.handlePageChange}
<PaginationTable
handlePageClick={pagination.handlePageChange}
currentPage={pagination.current}
max={pagination.pages}
totalPages={pagination.pages}
/>

<button
Expand Down

0 comments on commit 6ecaddb

Please sign in to comment.