Skip to content

Commit 45450eb

Browse files
sergesorokakerberizer
authored andcommitted
Added Current Page and Pages Count to Pagination
1 parent 471d530 commit 45450eb

File tree

5 files changed

+69
-2
lines changed

5 files changed

+69
-2
lines changed

package-lock.json

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
"json-format-highlight": "^1.0.4",
3030
"keycloak-js": "^26.0.0",
3131
"lucide-react": "^0.350.0",
32+
"oidc-client-ts": "^3.1.0",
3233
"react": "^18.2.0",
3334
"react-dom": "^18.2.0",
35+
"react-oidc-context": "^3.2.0",
3436
"react-router-dom": "^6.22.0",
3537
"survey-core": "latest",
3638
"survey-react-ui": "latest",

src/DataTable/TemplateTable.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ export default function TemplateTable({ data }) {
8787
},
8888
});
8989

90+
console.log(table.getPageCount());
91+
// console.log(table.getState().pagination.pageIndex);
92+
const pageCount = table.getPageCount();
93+
const currentPage = table.getState().pagination.pageIndex;
94+
9095
const setIdShosen = useSetIsShosen();
9196
useEffect(() => {
9297
setIdShosen(data && rowSelection ? data[rowSelection]?.uuid : null);
@@ -164,6 +169,12 @@ export default function TemplateTable({ data }) {
164169
>
165170
Previous
166171
</button>
172+
<div className="paginationPageCount">
173+
<p>
174+
page <span className="pageCurrent">{currentPage + 1}</span> of{" "}
175+
<span className="pageCurrent">{pageCount}</span>
176+
</p>
177+
</div>
167178
<button
168179
className="paginBtn"
169180
variant="outline"

src/StartScreenComp/StartScreenComp.css

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,26 @@ th {
162162
.pagination {
163163
margin-top: 2rem;
164164
display: flex;
165-
align-items: flex-end;
165+
align-items: center;
166166
justify-content: flex-end;
167-
gap: 12px;
167+
gap: 18px;
168+
}
169+
170+
.paginationPageCount {
171+
width: 110px;
172+
/* color: #777777; */
173+
/* text-transform: uppercase; */
174+
font-size: 14px;
175+
}
176+
.pageCurrent {
177+
display: inline-block;
178+
background-color: #e3f6ff;
179+
width: 20px;
180+
height: 20px;
181+
padding: 2px;
182+
border-radius: 50%;
183+
text-align: center;
184+
font-weight: 700;
168185
}
169186

170187
.paginBtn {

src/main.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react";
22
import ReactDOM from "react-dom/client";
33
import { createBrowserRouter, RouterProvider } from "react-router-dom";
4+
import { AuthProvider, useAuth } from "react-oidc-context";
45
import HomePage from "./pages/HomePage.tsx";
56
import TemplatePage from "./pages/TemplatePage.tsx";
67
import WizardPage from "./pages/WizardPage.tsx";

0 commit comments

Comments
 (0)