-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
163 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
packages/main/plugins/Cardinality/TotalsPanel/Pagination.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import FastForwardOutlinedIcon from "@mui/icons-material/FastForwardOutlined"; | ||
import FastRewindOutlinedIcon from "@mui/icons-material/FastRewindOutlined"; | ||
import SkipNextOutlinedIcon from "@mui/icons-material/SkipNextOutlined"; | ||
import SkipPreviousOutlinedIcon from "@mui/icons-material/SkipPreviousOutlined"; | ||
|
||
const TotalsPagination = ({ | ||
page, | ||
totalPages, | ||
setPage, | ||
rowsPerPage, | ||
setRowsPerPage, | ||
}) => { | ||
return ( | ||
<div className="table-footer"> | ||
<button | ||
className={page === 0 ? "disabled" : ""} | ||
onClick={() => setPage(() => 0)} | ||
> | ||
<FastRewindOutlinedIcon | ||
style={{ height: "12px", width: "12px" }} | ||
/>{" "} | ||
First | ||
</button> | ||
<button | ||
className={page === 0 ? "disabled" : ""} | ||
onClick={() => setPage(() => Math.max(0, page - 1))} | ||
> | ||
<SkipPreviousOutlinedIcon | ||
style={{ height: "12px", width: "12px" }} | ||
/>{" "} | ||
Prev | ||
</button> | ||
<p> | ||
Page {page + 1} of {totalPages} | ||
</p> | ||
<button | ||
className={page === totalPages - 1 ? "disabled" : ""} | ||
onClick={() => | ||
setPage(() => Math.min(totalPages - 1, page + 1)) | ||
} | ||
> | ||
Next{" "} | ||
<SkipNextOutlinedIcon | ||
style={{ height: "12px", width: "12px" }} | ||
/> | ||
</button> | ||
<button | ||
className={page === totalPages - 1 ? "disabled" : ""} | ||
onClick={() => setPage(totalPages - 1)} | ||
> | ||
Last{" "} | ||
<FastForwardOutlinedIcon | ||
style={{ height: "12px", width: "12px" }} | ||
/> | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TotalsPagination; |
53 changes: 53 additions & 0 deletions
53
packages/main/plugins/Cardinality/TotalsPanel/TotalsTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { TotalsRow } from "./TotalsRow"; | ||
import TotalsPagination from "./Pagination"; | ||
|
||
const TotalsTable = ({ | ||
headers, | ||
sortByProperty, | ||
isLoading, | ||
totals, | ||
page, | ||
setPage, | ||
rowsPerPage, | ||
setRowsPerPage, | ||
Maintainance, | ||
}) => { | ||
return ( | ||
<> | ||
<div className="table"> | ||
<div className="table-header"> | ||
{headers?.map((header) => ( | ||
<div | ||
key={header} | ||
onClick={() => sortByProperty(header)} | ||
className="cell" | ||
> | ||
{header} | ||
</div> | ||
))} | ||
</div> | ||
|
||
<div className="table-body"> | ||
{totals?.map((total, key) => ( | ||
<TotalsRow | ||
key={key} | ||
isLoading={isLoading} | ||
headers={headers} | ||
total={total} | ||
/> | ||
))} | ||
</div> | ||
</div> | ||
|
||
<TotalsPagination | ||
page={page} | ||
totalPages={Maintainance.length / rowsPerPage} | ||
setPage={setPage} | ||
rowsPerPage={rowsPerPage} | ||
setRowsPerPage={setRowsPerPage} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default TotalsTable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters