error boundary and table pagination
This commit is contained in:
@ -14,6 +14,7 @@ import { Loader } from "@components/Common/Loader/Loader";
|
||||
import { Navigation } from "@components/Navigation/Navigation";
|
||||
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
|
||||
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
|
||||
import { usePagination } from "@table-library/react-table-library/pagination";
|
||||
|
||||
import rightArrow from "assets/icons/arrows/arrowRight.svg";
|
||||
|
||||
@ -101,6 +102,13 @@ export const PartnerCategories = () => {
|
||||
}
|
||||
);
|
||||
|
||||
const pagination = usePagination(data, {
|
||||
state: {
|
||||
page: 0,
|
||||
size: 5,
|
||||
}
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setLoader(true);
|
||||
apiRequest("/project/my-employee").then((el) => {
|
||||
@ -259,7 +267,27 @@ export const PartnerCategories = () => {
|
||||
data={data}
|
||||
theme={theme}
|
||||
sort={sort}
|
||||
pagination={pagination}
|
||||
/>
|
||||
<div className="table__pagination">
|
||||
<span>Total Pages: {pagination.state.getTotalPages(data.nodes)}</span>
|
||||
|
||||
<span className="table__pages">
|
||||
Page:{" "}
|
||||
{pagination.state.getPages(data.nodes).map((_, index) => (
|
||||
<button
|
||||
key={index}
|
||||
type="button"
|
||||
style={{
|
||||
fontWeight: pagination.state.page === index ? "bold" : "normal",
|
||||
}}
|
||||
onClick={() => pagination.fns.onSetPage(index)}
|
||||
>
|
||||
{index + 1}
|
||||
</button>
|
||||
))}
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="partner-categories__empty">
|
||||
|
@ -176,5 +176,19 @@
|
||||
font-size: 16px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&__pagination {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 16px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&__pages {
|
||||
display: flex;
|
||||
column-gap: 5px;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user