@conduction/components 2.1.37 → 2.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/components/Pagination/Pagination.d.ts +9 -0
- package/lib/components/Pagination/Pagination.js +12 -0
- package/lib/components/Pagination/Pagination.module.css +91 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +2 -1
- package/src/components/Pagination/Pagination.module.css +91 -0
- package/src/components/Pagination/Pagination.tsx +44 -0
- package/src/components/formFields/createKeyValue/CreateKeyValue.tsx +0 -1
- package/src/index.ts +1 -1
- package/src/components/denhaag-wrappers/pagination/Pagination.css +0 -120
- package/src/components/denhaag-wrappers/pagination/Pagination.tsx +0 -112
package/README.md
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface PaginationProps {
|
|
3
|
+
totalPages: number;
|
|
4
|
+
currentPage: number;
|
|
5
|
+
setCurrentPage: React.Dispatch<React.SetStateAction<number>>;
|
|
6
|
+
layoutClassName?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const Pagination: React.FC<PaginationProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as styles from "./Pagination.module.css";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import ReactPaginate from "react-paginate";
|
|
5
|
+
import Button from "@gemeente-denhaag/button";
|
|
6
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
7
|
+
import { faChevronRight, faChevronLeft } from "@fortawesome/free-solid-svg-icons";
|
|
8
|
+
export const Pagination = ({ totalPages, currentPage, setCurrentPage, layoutClassName }) => {
|
|
9
|
+
if (totalPages < 1)
|
|
10
|
+
return _jsx(_Fragment, {}); // no pages available
|
|
11
|
+
return (_jsx(ReactPaginate, { className: clsx(styles.container, layoutClassName && layoutClassName), disabledClassName: styles.disabled, activeClassName: styles.currentPage, onPageChange: (e) => setCurrentPage(e.selected + 1), forcePage: currentPage - 1, pageRangeDisplayed: 3, pageCount: totalPages, disableInitialCallback: true, marginPagesDisplayed: 2, breakLabel: "...", nextLabel: _jsx(Button, { className: styles.button, children: _jsx(FontAwesomeIcon, { icon: faChevronRight }) }), previousLabel: _jsx(Button, { className: styles.button, children: _jsx(FontAwesomeIcon, { icon: faChevronLeft }) }) }));
|
|
12
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--conduction-pagination-container-background-color: unset;
|
|
3
|
+
--conduction-pagination-container-padding-inline-start: 0px;
|
|
4
|
+
--conduction-pagination-container-padding-inline-end: 0px;
|
|
5
|
+
--conduction-pagination-container-padding-block-start: 0px;
|
|
6
|
+
--conduction-pagination-container-padding-block-end: 0px;
|
|
7
|
+
|
|
8
|
+
--conduction-pagination-item-gap: 8px;
|
|
9
|
+
--conduction-pagination-item-color: #000000;
|
|
10
|
+
--conduction-pagination-item-background-color: #ffffff;
|
|
11
|
+
--conduction-pagination-item-border-radius: 4px;
|
|
12
|
+
--conduction-pagination-item-padding-inline-start: 8px;
|
|
13
|
+
--conduction-pagination-item-padding-inline-end: 8px;
|
|
14
|
+
--conduction-pagination-item-padding-block-start: 8px;
|
|
15
|
+
--conduction-pagination-item-padding-block-end: 8px;
|
|
16
|
+
|
|
17
|
+
--conduction-pagination-navigation-button-padding-inline-start: 8px;
|
|
18
|
+
--conduction-pagination-navigation-button-padding-inline-end: 8px;
|
|
19
|
+
--conduction-pagination-navigation-button-padding-block-start: 0px;
|
|
20
|
+
--conduction-pagination-navigation-button-padding-block-end: 0px;
|
|
21
|
+
|
|
22
|
+
--conduction-pagination-disabled-color: #d1d1d1;
|
|
23
|
+
--conduction-pagination-disabled-background-color: #fefefe;
|
|
24
|
+
|
|
25
|
+
--conduction-pagination-current-page-background-color: #4376fc;
|
|
26
|
+
--conduction-pagination-current-page-color: #ffffff;
|
|
27
|
+
--conduction-pagination-current-page-font-weight: bold;
|
|
28
|
+
--conduction-pagination-current-page-text-decoration: unset;
|
|
29
|
+
|
|
30
|
+
--conduction-pagination-page-hover-color: #4376fc;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.container {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-wrap: wrap;
|
|
36
|
+
align-items: center;
|
|
37
|
+
list-style-type: none;
|
|
38
|
+
gap: var(--conduction-pagination-item-gap);
|
|
39
|
+
background-color: var(--conduction-pagination-container-background-color);
|
|
40
|
+
padding-inline-start: var(--conduction-pagination-container-padding-inline-start);
|
|
41
|
+
padding-inline-end: var(--conduction-pagination-container-padding-inline-end);
|
|
42
|
+
padding-block-start: var(--conduction-pagination-container-padding-block-start);
|
|
43
|
+
padding-block-end: var(--conduction-pagination-container-padding-block-end);
|
|
44
|
+
user-select: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.container > li > a {
|
|
48
|
+
color: var(--conduction-pagination-item-color);
|
|
49
|
+
background-color: var(--conduction-pagination-item-background-color);
|
|
50
|
+
border-radius: var(--conduction-pagination-item-border-radius);
|
|
51
|
+
padding-inline-start: var(--conduction-pagination-item-padding-inline-start);
|
|
52
|
+
padding-inline-end: var(--conduction-pagination-item-padding-inline-end);
|
|
53
|
+
padding-block-start: var(--conduction-pagination-item-padding-block-start);
|
|
54
|
+
padding-block-end: var(--conduction-pagination-item-padding-block-end);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.button {
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.container > li.currentPage > a {
|
|
62
|
+
color: var(--conduction-pagination-current-page-color);
|
|
63
|
+
background-color: var(--conduction-pagination-current-page-background-color);
|
|
64
|
+
font-weight: var(--conduction-pagination-current-page-font-weight);
|
|
65
|
+
text-decoration: var(--conduction-pagination-current-page-text-decoration);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.disabled:hover,
|
|
69
|
+
.currentPage:hover {
|
|
70
|
+
cursor: not-allowed;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.container > li.disabled > a {
|
|
74
|
+
color: var(--conduction-pagination-disabled-color);
|
|
75
|
+
background-color: var(--conduction-pagination-disabled-background-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.container > li:hover:not(.disabled):not(.currentPage) {
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.container > li:hover:not(.disabled):not(.currentPage) > a {
|
|
83
|
+
color: var(--conduction-pagination-page-hover-color);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.button {
|
|
87
|
+
padding-inline-start: var(--conduction-pagination-navigation-button-padding-inline-start) !important;
|
|
88
|
+
padding-inline-end: var(--conduction-pagination-navigation-button-padding-inline-end) !important;
|
|
89
|
+
padding-block-start: var(--conduction-pagination-navigation-button-padding-block-start) !important;
|
|
90
|
+
padding-block-end: var(--conduction-pagination-navigation-button-padding-block-end) !important;
|
|
91
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ declare const NotificationPopUp: {
|
|
|
19
19
|
NotificationPopUp: ({ title, description, isVisible, hide, primaryButton, secondaryButton, layoutClassName, }: import("./components/notificationPopUp/NotificationPopUp").NotificationPopUpProps) => JSX.Element | null;
|
|
20
20
|
};
|
|
21
21
|
import { QuoteWrapper } from "./components/quoteWrapper/QuoteWrapper";
|
|
22
|
-
import { Pagination } from "./components/denhaag-wrappers/pagination/Pagination";
|
|
23
22
|
import { BadgeCounter } from "./components/badgeCounter/BadgeCounter";
|
|
24
23
|
import { CodeBlock } from "./components/codeBlock/CodeBlock";
|
|
25
24
|
import { ToolTip } from "./components/toolTip/ToolTip";
|
|
25
|
+
import { Pagination } from "./components/Pagination/Pagination";
|
|
26
26
|
export { InputRadio, DownloadCard, HorizontalImageCard, ImageAndDetailsCard, RichContentCard, DetailsCard, InfoCard, Container, Breadcrumbs, EditableTableRow, InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile, Textarea, InputCheckbox, SelectMultiple, SelectSingle, ImageDivider, AuthenticatedLogo, UnauthenticatedLogo, MetaIcon, PrivateRoute, PrimaryTopNav, SecondaryTopNav, Tag, NotificationPopUp, QuoteWrapper, Pagination, BadgeCounter, CodeBlock, ToolTip, };
|
package/lib/index.js
CHANGED
|
@@ -12,8 +12,8 @@ import { Tag } from "./components/tag/Tag";
|
|
|
12
12
|
import { NotificationPopUpController, NotificationPopUp as _NotificationPopUp, } from "./components/notificationPopUp/NotificationPopUp";
|
|
13
13
|
const NotificationPopUp = { controller: NotificationPopUpController, NotificationPopUp: _NotificationPopUp };
|
|
14
14
|
import { QuoteWrapper } from "./components/quoteWrapper/QuoteWrapper";
|
|
15
|
-
import { Pagination } from "./components/denhaag-wrappers/pagination/Pagination";
|
|
16
15
|
import { BadgeCounter } from "./components/badgeCounter/BadgeCounter";
|
|
17
16
|
import { CodeBlock } from "./components/codeBlock/CodeBlock";
|
|
18
17
|
import { ToolTip } from "./components/toolTip/ToolTip";
|
|
18
|
+
import { Pagination } from "./components/Pagination/Pagination";
|
|
19
19
|
export { InputRadio, DownloadCard, HorizontalImageCard, ImageAndDetailsCard, RichContentCard, DetailsCard, InfoCard, Container, Breadcrumbs, EditableTableRow, InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile, Textarea, InputCheckbox, SelectMultiple, SelectSingle, ImageDivider, AuthenticatedLogo, UnauthenticatedLogo, MetaIcon, PrivateRoute, PrimaryTopNav, SecondaryTopNav, Tag, NotificationPopUp, QuoteWrapper, Pagination, BadgeCounter, CodeBlock, ToolTip, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conduction/components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.38",
|
|
4
4
|
"description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"react": "^18.2.0",
|
|
44
44
|
"react-datepicker": "^4.10.0",
|
|
45
45
|
"react-hook-form": "7.29.0",
|
|
46
|
+
"react-paginate": "^8.2.0",
|
|
46
47
|
"react-select": "5.3.2",
|
|
47
48
|
"react-tooltip": "^4.2.21"
|
|
48
49
|
},
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--conduction-pagination-container-background-color: unset;
|
|
3
|
+
--conduction-pagination-container-padding-inline-start: 0px;
|
|
4
|
+
--conduction-pagination-container-padding-inline-end: 0px;
|
|
5
|
+
--conduction-pagination-container-padding-block-start: 0px;
|
|
6
|
+
--conduction-pagination-container-padding-block-end: 0px;
|
|
7
|
+
|
|
8
|
+
--conduction-pagination-item-gap: 8px;
|
|
9
|
+
--conduction-pagination-item-color: #000000;
|
|
10
|
+
--conduction-pagination-item-background-color: #ffffff;
|
|
11
|
+
--conduction-pagination-item-border-radius: 4px;
|
|
12
|
+
--conduction-pagination-item-padding-inline-start: 8px;
|
|
13
|
+
--conduction-pagination-item-padding-inline-end: 8px;
|
|
14
|
+
--conduction-pagination-item-padding-block-start: 8px;
|
|
15
|
+
--conduction-pagination-item-padding-block-end: 8px;
|
|
16
|
+
|
|
17
|
+
--conduction-pagination-navigation-button-padding-inline-start: 8px;
|
|
18
|
+
--conduction-pagination-navigation-button-padding-inline-end: 8px;
|
|
19
|
+
--conduction-pagination-navigation-button-padding-block-start: 0px;
|
|
20
|
+
--conduction-pagination-navigation-button-padding-block-end: 0px;
|
|
21
|
+
|
|
22
|
+
--conduction-pagination-disabled-color: #d1d1d1;
|
|
23
|
+
--conduction-pagination-disabled-background-color: #fefefe;
|
|
24
|
+
|
|
25
|
+
--conduction-pagination-current-page-background-color: #4376fc;
|
|
26
|
+
--conduction-pagination-current-page-color: #ffffff;
|
|
27
|
+
--conduction-pagination-current-page-font-weight: bold;
|
|
28
|
+
--conduction-pagination-current-page-text-decoration: unset;
|
|
29
|
+
|
|
30
|
+
--conduction-pagination-page-hover-color: #4376fc;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.container {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-wrap: wrap;
|
|
36
|
+
align-items: center;
|
|
37
|
+
list-style-type: none;
|
|
38
|
+
gap: var(--conduction-pagination-item-gap);
|
|
39
|
+
background-color: var(--conduction-pagination-container-background-color);
|
|
40
|
+
padding-inline-start: var(--conduction-pagination-container-padding-inline-start);
|
|
41
|
+
padding-inline-end: var(--conduction-pagination-container-padding-inline-end);
|
|
42
|
+
padding-block-start: var(--conduction-pagination-container-padding-block-start);
|
|
43
|
+
padding-block-end: var(--conduction-pagination-container-padding-block-end);
|
|
44
|
+
user-select: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.container > li > a {
|
|
48
|
+
color: var(--conduction-pagination-item-color);
|
|
49
|
+
background-color: var(--conduction-pagination-item-background-color);
|
|
50
|
+
border-radius: var(--conduction-pagination-item-border-radius);
|
|
51
|
+
padding-inline-start: var(--conduction-pagination-item-padding-inline-start);
|
|
52
|
+
padding-inline-end: var(--conduction-pagination-item-padding-inline-end);
|
|
53
|
+
padding-block-start: var(--conduction-pagination-item-padding-block-start);
|
|
54
|
+
padding-block-end: var(--conduction-pagination-item-padding-block-end);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.button {
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.container > li.currentPage > a {
|
|
62
|
+
color: var(--conduction-pagination-current-page-color);
|
|
63
|
+
background-color: var(--conduction-pagination-current-page-background-color);
|
|
64
|
+
font-weight: var(--conduction-pagination-current-page-font-weight);
|
|
65
|
+
text-decoration: var(--conduction-pagination-current-page-text-decoration);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.disabled:hover,
|
|
69
|
+
.currentPage:hover {
|
|
70
|
+
cursor: not-allowed;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.container > li.disabled > a {
|
|
74
|
+
color: var(--conduction-pagination-disabled-color);
|
|
75
|
+
background-color: var(--conduction-pagination-disabled-background-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.container > li:hover:not(.disabled):not(.currentPage) {
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.container > li:hover:not(.disabled):not(.currentPage) > a {
|
|
83
|
+
color: var(--conduction-pagination-page-hover-color);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.button {
|
|
87
|
+
padding-inline-start: var(--conduction-pagination-navigation-button-padding-inline-start) !important;
|
|
88
|
+
padding-inline-end: var(--conduction-pagination-navigation-button-padding-inline-end) !important;
|
|
89
|
+
padding-block-start: var(--conduction-pagination-navigation-button-padding-block-start) !important;
|
|
90
|
+
padding-block-end: var(--conduction-pagination-navigation-button-padding-block-end) !important;
|
|
91
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as styles from "./Pagination.module.css";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
|
|
5
|
+
import ReactPaginate from "react-paginate";
|
|
6
|
+
import Button from "@gemeente-denhaag/button";
|
|
7
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
8
|
+
import { faChevronRight, faChevronLeft } from "@fortawesome/free-solid-svg-icons";
|
|
9
|
+
|
|
10
|
+
interface PaginationProps {
|
|
11
|
+
totalPages: number;
|
|
12
|
+
currentPage: number;
|
|
13
|
+
setCurrentPage: React.Dispatch<React.SetStateAction<number>>;
|
|
14
|
+
layoutClassName?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Pagination: React.FC<PaginationProps> = ({ totalPages, currentPage, setCurrentPage, layoutClassName }) => {
|
|
18
|
+
if (totalPages < 1) return <></>; // no pages available
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<ReactPaginate
|
|
22
|
+
className={clsx(styles.container, layoutClassName && layoutClassName)}
|
|
23
|
+
disabledClassName={styles.disabled}
|
|
24
|
+
activeClassName={styles.currentPage}
|
|
25
|
+
onPageChange={(e: any) => setCurrentPage(e.selected + 1)}
|
|
26
|
+
forcePage={currentPage - 1}
|
|
27
|
+
pageRangeDisplayed={3}
|
|
28
|
+
pageCount={totalPages}
|
|
29
|
+
disableInitialCallback
|
|
30
|
+
marginPagesDisplayed={2}
|
|
31
|
+
breakLabel="..."
|
|
32
|
+
nextLabel={
|
|
33
|
+
<Button className={styles.button}>
|
|
34
|
+
<FontAwesomeIcon icon={faChevronRight} />
|
|
35
|
+
</Button>
|
|
36
|
+
}
|
|
37
|
+
previousLabel={
|
|
38
|
+
<Button className={styles.button}>
|
|
39
|
+
<FontAwesomeIcon icon={faChevronLeft} />
|
|
40
|
+
</Button>
|
|
41
|
+
}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -2,7 +2,6 @@ import * as React from "react";
|
|
|
2
2
|
import * as styles from "./CreateKeyValue.module.css";
|
|
3
3
|
import { Control, Controller, FieldValues } from "react-hook-form";
|
|
4
4
|
import { IReactHookFormProps } from "../types";
|
|
5
|
-
import { IInputProps } from "../input";
|
|
6
5
|
import { Button } from "@gemeente-denhaag/button";
|
|
7
6
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@gemeente-denhaag/table";
|
|
8
7
|
import { ToolTip } from "../../toolTip/ToolTip";
|
package/src/index.ts
CHANGED
|
@@ -34,10 +34,10 @@ import {
|
|
|
34
34
|
} from "./components/notificationPopUp/NotificationPopUp";
|
|
35
35
|
const NotificationPopUp = { controller: NotificationPopUpController, NotificationPopUp: _NotificationPopUp };
|
|
36
36
|
import { QuoteWrapper } from "./components/quoteWrapper/QuoteWrapper";
|
|
37
|
-
import { Pagination } from "./components/denhaag-wrappers/pagination/Pagination";
|
|
38
37
|
import { BadgeCounter } from "./components/badgeCounter/BadgeCounter";
|
|
39
38
|
import { CodeBlock } from "./components/codeBlock/CodeBlock";
|
|
40
39
|
import { ToolTip } from "./components/toolTip/ToolTip";
|
|
40
|
+
import { Pagination } from "./components/Pagination/Pagination";
|
|
41
41
|
|
|
42
42
|
export {
|
|
43
43
|
InputRadio,
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
.denhaag-pagination {
|
|
2
|
-
--denhaag-pagination-align: center;
|
|
3
|
-
|
|
4
|
-
align-items: center;
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: row;
|
|
7
|
-
justify-content: var(--denhaag-pagination-align);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@media (min-width: 640px) {
|
|
11
|
-
.denhaag-pagination,
|
|
12
|
-
.denhaag-pagination--start {
|
|
13
|
-
--denhaag-pagination-align: flex-start;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.denhaag-pagination--center {
|
|
17
|
-
--denhaag-pagination-align: center;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.denhaag-pagination--end {
|
|
21
|
-
--denhaag-pagination-align: end;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.denhaag-pagination__links {
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: row;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.denhaag-pagination__link {
|
|
31
|
-
aspect-ratio: 1 / 1;
|
|
32
|
-
align-items: center;
|
|
33
|
-
background-color: var(--denhaag-pagination-background-color, transparent);
|
|
34
|
-
border: 0;
|
|
35
|
-
border-radius: var(
|
|
36
|
-
--denhaag-pagination-border-radius,
|
|
37
|
-
var(--denhaag-border-radius)
|
|
38
|
-
);
|
|
39
|
-
color: var(--denhaag-pagination-color, var(--denhaag-pagination-link-color));
|
|
40
|
-
display: flex;
|
|
41
|
-
height: var(--denhaag-pagination-size);
|
|
42
|
-
justify-content: center;
|
|
43
|
-
line-height: 1.5;
|
|
44
|
-
position: relative;
|
|
45
|
-
text-align: center;
|
|
46
|
-
text-decoration: none;
|
|
47
|
-
width: var(--denhaag-pagination-size);
|
|
48
|
-
font-style: normal;
|
|
49
|
-
font-weight: var(--denhaag-pagination-font-weight);
|
|
50
|
-
font-size: var(--denhaag-pagination-font-size);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.denhaag-pagination__link:hover,
|
|
54
|
-
.denhaag-pagination__link--hover {
|
|
55
|
-
--denhaag-pagination-color: var(--denhaag-pagination-link-hover-color);
|
|
56
|
-
cursor: pointer;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.denhaag-pagination__link:focus,
|
|
60
|
-
.denhaag-pagination__link--focus {
|
|
61
|
-
outline: var(--denhaag-link-focus-outline);
|
|
62
|
-
border-radius: 0;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.denhaag-pagination__link:disabled,
|
|
66
|
-
.denhaag-pagination__link--disabled {
|
|
67
|
-
--denhaag-pagination-color: var(--denhaag-pagination-link-disabled-color);
|
|
68
|
-
|
|
69
|
-
pointer-events: none;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.denhaag-pagination__link--arrow {
|
|
73
|
-
--denhaag-pagination-size: var(--denhaag-pagination-arrow-size);
|
|
74
|
-
--denhaag-pagination-font-size: var(--denhaag-pagination-arrow-font-size);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
[dir="rtl"] .denhaag-pagination__link--arrow {
|
|
78
|
-
transform: scaleX(-1);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.denhaag-pagination__link + .denhaag-pagination__links,
|
|
82
|
-
.denhaag-pagination__links + .denhaag-pagination__link {
|
|
83
|
-
margin-inline-start: var(--denhaag-pagination-margin-inline, 10px);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.denhaag-pagination__link:not(:first-child):not(:last-child):not(.denhaag-pagination__link--current):not([rel]) {
|
|
87
|
-
overflow: hidden;
|
|
88
|
-
pointer-events: none;
|
|
89
|
-
text-indent: calc(var(--denhaag-pagination-size) * 2);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.denhaag-pagination__link:not(:first-child):not(:last-child):not(.denhaag-pagination__link--current):not([rel])::before {
|
|
93
|
-
content: "...";
|
|
94
|
-
left: calc(50% - 7px);
|
|
95
|
-
line-height: 0;
|
|
96
|
-
position: absolute;
|
|
97
|
-
text-indent: 0;
|
|
98
|
-
vertical-align: baseline;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.denhaag-pagination__link--current {
|
|
102
|
-
--denhaag-pagination-color: var(--denhaag-pagination-link-current-color);
|
|
103
|
-
--denhaag-pagination-font-weight: var(
|
|
104
|
-
--denhaag-pagination-link-current-font-weight
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.denhaag-pagination__link--current.denhaag-pagination__link:disabled,
|
|
109
|
-
.denhaag-pagination__link--current.denhaag-pagination__link--disabled {
|
|
110
|
-
--denhaag-pagination-color: var(
|
|
111
|
-
--denhaag-pagination-link-current-disabled-color
|
|
112
|
-
);
|
|
113
|
-
--denhaag-pagination-background-color: var(
|
|
114
|
-
--denhaag-pagination-link-current-disabled-background-color
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.denhaag-pagination .denhaag-icon {
|
|
119
|
-
font-size: inherit;
|
|
120
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import "./Pagination.css";
|
|
4
|
-
|
|
5
|
-
interface PaginationProps {
|
|
6
|
-
pages: number;
|
|
7
|
-
currentPage: number;
|
|
8
|
-
setPage: (page: number) => any;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const Pagination = ({ pages, currentPage, setPage }: PaginationProps): JSX.Element => {
|
|
12
|
-
return (
|
|
13
|
-
<nav className="denhaag-pagination">
|
|
14
|
-
<PreviousButton previousPage={currentPage > 1 ? currentPage - 1 : undefined} {...{ setPage }} />
|
|
15
|
-
|
|
16
|
-
<span className="denhaag-pagination__links" role="group">
|
|
17
|
-
{Array.from({ length: pages }, (_, i) => i + 1).map((page, idx) => (
|
|
18
|
-
<Link key={idx} {...{ page }} current={page === currentPage} {...{ setPage }} />
|
|
19
|
-
))}
|
|
20
|
-
</span>
|
|
21
|
-
|
|
22
|
-
<NextButton nextPage={currentPage < pages ? currentPage + 1 : undefined} {...{ setPage }} />
|
|
23
|
-
</nav>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
interface LinkProps {
|
|
28
|
-
page: number;
|
|
29
|
-
setPage: (page: number) => any;
|
|
30
|
-
current?: boolean;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const Link = ({ page, current, setPage }: LinkProps): JSX.Element => {
|
|
34
|
-
return (
|
|
35
|
-
<a
|
|
36
|
-
aria-current={current && "page"}
|
|
37
|
-
aria-label={`Page ${page}`}
|
|
38
|
-
className={clsx("denhaag-pagination__link", current && "denhaag-pagination__link--current")}
|
|
39
|
-
onClick={() => setPage(page)}
|
|
40
|
-
>
|
|
41
|
-
{page}
|
|
42
|
-
</a>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
interface PreviousButtonProps {
|
|
47
|
-
setPage: (page: number) => any;
|
|
48
|
-
previousPage?: number;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const PreviousButton = ({ previousPage, setPage }: PreviousButtonProps): JSX.Element => {
|
|
52
|
-
return (
|
|
53
|
-
<a
|
|
54
|
-
aria-label="Previous page"
|
|
55
|
-
className={clsx(
|
|
56
|
-
"denhaag-pagination__link denhaag-pagination__link--arrow",
|
|
57
|
-
!previousPage && "denhaag-pagination__link--disabled",
|
|
58
|
-
)}
|
|
59
|
-
onClick={() => previousPage && setPage(previousPage)}
|
|
60
|
-
rel="prev"
|
|
61
|
-
>
|
|
62
|
-
<svg
|
|
63
|
-
aria-hidden="true"
|
|
64
|
-
className="denhaag-icon"
|
|
65
|
-
fill="none"
|
|
66
|
-
height="1em"
|
|
67
|
-
viewBox="0 0 7 12"
|
|
68
|
-
width="1em"
|
|
69
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
70
|
-
>
|
|
71
|
-
<path
|
|
72
|
-
d="M4.9921 10.8143C5.36382 11.1914 5.97222 11.1914 6.34393 10.8143C6.7079 10.4451 6.70822 9.8521 6.34466 9.48248L3.36315 6.45123C2.98039 6.06209 2.98039 5.43791 3.36315 5.04877L6.34466 2.01752C6.70822 1.6479 6.7079 1.05492 6.34394 0.685696C5.97222 0.308599 5.36382 0.308599 4.9921 0.685695L0.692003 5.04799C0.308224 5.43732 0.308224 6.06268 0.692003 6.45201L4.9921 10.8143Z"
|
|
73
|
-
fill="currentColor"
|
|
74
|
-
/>
|
|
75
|
-
</svg>
|
|
76
|
-
</a>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
interface NextButtonProps {
|
|
81
|
-
setPage: (page: number) => any;
|
|
82
|
-
nextPage?: number;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const NextButton = ({ nextPage, setPage }: NextButtonProps): JSX.Element => {
|
|
86
|
-
return (
|
|
87
|
-
<a
|
|
88
|
-
aria-label="Next page"
|
|
89
|
-
className={clsx(
|
|
90
|
-
"denhaag-pagination__link denhaag-pagination__link--arrow",
|
|
91
|
-
!nextPage && "denhaag-pagination__link--disabled",
|
|
92
|
-
)}
|
|
93
|
-
onClick={() => nextPage && setPage(nextPage)}
|
|
94
|
-
rel="next"
|
|
95
|
-
>
|
|
96
|
-
<svg
|
|
97
|
-
aria-hidden="true"
|
|
98
|
-
className="denhaag-icon"
|
|
99
|
-
fill="none"
|
|
100
|
-
height="1em"
|
|
101
|
-
viewBox="0 0 7 12"
|
|
102
|
-
width="1em"
|
|
103
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
104
|
-
>
|
|
105
|
-
<path
|
|
106
|
-
d="M2.0079 1.1857C1.63618 0.8086 1.02778 0.8086 0.656065 1.18569V1.18569C0.292103 1.55492 0.291779 2.1479 0.655339 2.51752L3.63685 5.54877C4.01961 5.93791 4.01961 6.56209 3.63686 6.95123L0.655339 9.98248C0.291779 10.3521 0.292102 10.9451 0.656065 11.3143V11.3143C1.02778 11.6914 1.63618 11.6914 2.0079 11.3143L6.308 6.95201C6.69178 6.56268 6.69178 5.93732 6.308 5.54799L2.0079 1.1857Z"
|
|
107
|
-
fill="currentColor"
|
|
108
|
-
/>
|
|
109
|
-
</svg>
|
|
110
|
-
</a>
|
|
111
|
-
);
|
|
112
|
-
};
|