@developer-overheid-nl/don-register-components 1.2.0 → 1.3.0
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/CHANGELOG.md +118 -85
- package/LICENSE.md +291 -291
- package/README.md +20 -20
- package/package.json +2 -2
- package/src/alert/Alert.tsx +19 -19
- package/src/alert/styles.module.css +3 -3
- package/src/alignBox/AlignBox.tsx +114 -114
- package/src/alignBox/styles.module.css +110 -110
- package/src/amountLabel/AmountLabel.tsx +16 -16
- package/src/amountLabel/styles.module.css +11 -11
- package/src/analytics/PiwikPro.tsx +94 -94
- package/src/analytics/index.ts +1 -1
- package/src/article/Article.tsx +10 -10
- package/src/badgeList/BadgeList.tsx +34 -26
- package/src/badgeList/styles.module.css +37 -24
- package/src/block/Block.tsx +35 -35
- package/src/block/styles.module.css +29 -29
- package/src/button/Button.tsx +3 -3
- package/src/cardAsLink/CardAsLink.tsx +21 -21
- package/src/cardAsLink/styles.module.css +23 -23
- package/src/cardsList/CardsList.tsx +54 -54
- package/src/cardsList/styles.module.css +19 -19
- package/src/client.ts +7 -7
- package/src/container/Container.tsx +10 -10
- package/src/container/styles.module.css +28 -28
- package/src/copyButton/CopyButton.tsx +39 -39
- package/src/copyButton/styles.module.css +13 -13
- package/src/dataBadgeLink/DataBadgeLink.tsx +53 -53
- package/src/dataBadgeLink/styles.module.css +89 -69
- package/src/dataSummary/DataSummary.tsx +22 -22
- package/src/dataSummary/DataSummaryItem.tsx +21 -21
- package/src/dataSummary/styles.module.css +75 -75
- package/src/facetFilters/FacetFilters.tsx +367 -313
- package/src/facetFilters/styles.module.css +3 -3
- package/src/fieldset/FieldSet.tsx +3 -3
- package/src/filters/Filters.tsx +116 -115
- package/src/filters/styles.module.css +26 -26
- package/src/footer/Footer.tsx +76 -76
- package/src/footer/styles.module.css +103 -103
- package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.tsx +16 -16
- package/src/formFieldCheckboxGroup/styles.module.css +5 -5
- package/src/formFieldCheckboxOption/FormFieldCheckboxOption.tsx +26 -26
- package/src/formFieldCheckboxOption/styles.module.css +22 -22
- package/src/formFieldLabel/FormFieldLabel.tsx +23 -23
- package/src/formFieldRadioGroup/FormFieldRadioGroup.tsx +13 -13
- package/src/formFieldRadioGroup/styles.module.css +5 -5
- package/src/formFieldRadioOption/FormFieldRadioOption.tsx +75 -75
- package/src/formFieldRadioOption/styles.module.css +49 -49
- package/src/formFieldSwitch/FormFieldSwitch.tsx +79 -79
- package/src/formFieldSwitch/styles.module.css +32 -32
- package/src/formFieldTextInput/FormFieldTextInput.tsx +3 -3
- package/src/header/Header.tsx +137 -137
- package/src/header/styles.module.css +71 -71
- package/src/heading/Heading.tsx +15 -15
- package/src/headingGroup/HeadingGroup.tsx +48 -48
- package/src/headingGroup/styles.module.css +3 -3
- package/src/i18n.ts +25 -25
- package/src/iconBadge/IconBadge.tsx +35 -35
- package/src/iconBadge/getAppearance.ts +53 -53
- package/src/iconBadge/styles.module.css +19 -19
- package/src/iconsSprite/Icon.tsx +17 -17
- package/src/iconsSprite/IconsSprite.tsx +5 -5
- package/src/index.ts +107 -106
- package/src/infoButton/InfoButton.tsx +45 -45
- package/src/infoButton/styles.module.css +43 -43
- package/src/link/Link.tsx +10 -10
- package/src/markdown/Markdown.tsx +42 -42
- package/src/overlay/Overlay.tsx +18 -18
- package/src/overlay/styles.module.css +15 -15
- package/src/pagination/Pagination.tsx +267 -144
- package/src/pagination/styles.module.css +28 -13
- package/src/paragraph/Paragraph.tsx +24 -24
- package/src/paragraph/styles.module.css +6 -6
- package/src/pillBadge/PillBadge.examples.tsx +107 -107
- package/src/pillBadge/PillBadge.tsx +51 -51
- package/src/pillBadge/styles.module.css +214 -214
- package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
- package/src/readOnlyTextInput/styles.module.css +19 -19
- package/src/scoreBadge/ScoreBadge.tsx +133 -133
- package/src/search/Search.tsx +82 -66
- package/src/search/styles.module.css +39 -39
- package/src/siteLogo/SiteLogo.tsx +24 -24
- package/src/switch/Switch.tsx +86 -86
- package/src/switch/styles.module.css +7 -7
- package/src/toolTip/ToolTip.tsx +55 -55
- package/src/toolTip/styles.module.css +49 -48
- package/src/topNavigation/TopNavigation.tsx +67 -67
- package/src/topNavigation/styles.module.css +54 -54
- package/tsconfig.json +121 -121
package/src/switch/Switch.tsx
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import {
|
|
3
|
-
type ForwardedRef,
|
|
4
|
-
forwardRef,
|
|
5
|
-
type InputHTMLAttributes,
|
|
6
|
-
useId,
|
|
7
|
-
} from "react";
|
|
8
|
-
import styles from "./styles.module.css";
|
|
9
|
-
|
|
10
|
-
export interface SwitchLabels {
|
|
11
|
-
on: string;
|
|
12
|
-
off: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface SwitchProps
|
|
16
|
-
extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "readOnly"> {
|
|
17
|
-
invalid?: boolean;
|
|
18
|
-
labels?: SwitchLabels;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const Switch = forwardRef(
|
|
22
|
-
(props: SwitchProps, ref: ForwardedRef<HTMLInputElement>) => {
|
|
23
|
-
const genId = useId();
|
|
24
|
-
const {
|
|
25
|
-
id = genId,
|
|
26
|
-
disabled,
|
|
27
|
-
invalid,
|
|
28
|
-
required,
|
|
29
|
-
hidden,
|
|
30
|
-
checked,
|
|
31
|
-
defaultChecked,
|
|
32
|
-
role,
|
|
33
|
-
tabIndex,
|
|
34
|
-
className,
|
|
35
|
-
labels = { on: "ON", off: "OFF" },
|
|
36
|
-
...restProps
|
|
37
|
-
} = props;
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<div
|
|
41
|
-
className={clsx(
|
|
42
|
-
"utrecht-form-toggle",
|
|
43
|
-
"utrecht-form-toggle--html-checkbox",
|
|
44
|
-
{
|
|
45
|
-
"utrecht-form-toggle--disabled": disabled,
|
|
46
|
-
"utrecht-form-toggle--invalid": invalid,
|
|
47
|
-
"utrecht-form-toggle--required": required,
|
|
48
|
-
},
|
|
49
|
-
styles.switch,
|
|
50
|
-
className,
|
|
51
|
-
)}
|
|
52
|
-
hidden={hidden}
|
|
53
|
-
>
|
|
54
|
-
<input
|
|
55
|
-
id={id}
|
|
56
|
-
aria-invalid={invalid || undefined}
|
|
57
|
-
type="checkbox"
|
|
58
|
-
className="utrecht-form-toggle__checkbox"
|
|
59
|
-
checked={checked}
|
|
60
|
-
defaultChecked={defaultChecked || undefined}
|
|
61
|
-
disabled={disabled || undefined}
|
|
62
|
-
required={required}
|
|
63
|
-
ref={ref}
|
|
64
|
-
role={role}
|
|
65
|
-
tabIndex={tabIndex}
|
|
66
|
-
{...restProps}
|
|
67
|
-
/>
|
|
68
|
-
<label
|
|
69
|
-
htmlFor={id}
|
|
70
|
-
className={clsx(
|
|
71
|
-
"utrecht-form-toggle__track",
|
|
72
|
-
"utrecht-form-toggle__track--html-label",
|
|
73
|
-
)}
|
|
74
|
-
>
|
|
75
|
-
<div className="utrecht-form-toggle__thumb">
|
|
76
|
-
<span className="sr-only">
|
|
77
|
-
{checked || defaultChecked ? labels.on : labels.off}
|
|
78
|
-
</span>
|
|
79
|
-
</div>
|
|
80
|
-
</label>
|
|
81
|
-
</div>
|
|
82
|
-
);
|
|
83
|
-
},
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
export default Switch;
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import {
|
|
3
|
+
type ForwardedRef,
|
|
4
|
+
forwardRef,
|
|
5
|
+
type InputHTMLAttributes,
|
|
6
|
+
useId,
|
|
7
|
+
} from "react";
|
|
8
|
+
import styles from "./styles.module.css";
|
|
9
|
+
|
|
10
|
+
export interface SwitchLabels {
|
|
11
|
+
on: string;
|
|
12
|
+
off: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SwitchProps
|
|
16
|
+
extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "readOnly"> {
|
|
17
|
+
invalid?: boolean;
|
|
18
|
+
labels?: SwitchLabels;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const Switch = forwardRef(
|
|
22
|
+
(props: SwitchProps, ref: ForwardedRef<HTMLInputElement>) => {
|
|
23
|
+
const genId = useId();
|
|
24
|
+
const {
|
|
25
|
+
id = genId,
|
|
26
|
+
disabled,
|
|
27
|
+
invalid,
|
|
28
|
+
required,
|
|
29
|
+
hidden,
|
|
30
|
+
checked,
|
|
31
|
+
defaultChecked,
|
|
32
|
+
role,
|
|
33
|
+
tabIndex,
|
|
34
|
+
className,
|
|
35
|
+
labels = { on: "ON", off: "OFF" },
|
|
36
|
+
...restProps
|
|
37
|
+
} = props;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
className={clsx(
|
|
42
|
+
"utrecht-form-toggle",
|
|
43
|
+
"utrecht-form-toggle--html-checkbox",
|
|
44
|
+
{
|
|
45
|
+
"utrecht-form-toggle--disabled": disabled,
|
|
46
|
+
"utrecht-form-toggle--invalid": invalid,
|
|
47
|
+
"utrecht-form-toggle--required": required,
|
|
48
|
+
},
|
|
49
|
+
styles.switch,
|
|
50
|
+
className,
|
|
51
|
+
)}
|
|
52
|
+
hidden={hidden}
|
|
53
|
+
>
|
|
54
|
+
<input
|
|
55
|
+
id={id}
|
|
56
|
+
aria-invalid={invalid || undefined}
|
|
57
|
+
type="checkbox"
|
|
58
|
+
className="utrecht-form-toggle__checkbox"
|
|
59
|
+
checked={checked}
|
|
60
|
+
defaultChecked={defaultChecked || undefined}
|
|
61
|
+
disabled={disabled || undefined}
|
|
62
|
+
required={required}
|
|
63
|
+
ref={ref}
|
|
64
|
+
role={role}
|
|
65
|
+
tabIndex={tabIndex}
|
|
66
|
+
{...restProps}
|
|
67
|
+
/>
|
|
68
|
+
<label
|
|
69
|
+
htmlFor={id}
|
|
70
|
+
className={clsx(
|
|
71
|
+
"utrecht-form-toggle__track",
|
|
72
|
+
"utrecht-form-toggle__track--html-label",
|
|
73
|
+
)}
|
|
74
|
+
>
|
|
75
|
+
<div className="utrecht-form-toggle__thumb">
|
|
76
|
+
<span className="sr-only">
|
|
77
|
+
{checked || defaultChecked ? labels.on : labels.off}
|
|
78
|
+
</span>
|
|
79
|
+
</div>
|
|
80
|
+
</label>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
export default Switch;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
.switch {
|
|
2
|
-
&:hover {
|
|
3
|
-
:global(.utrecht-form-toggle__track) {
|
|
4
|
-
background-color: var(--utrecht-form-toggle-hover-background-color);
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
.switch {
|
|
2
|
+
&:hover {
|
|
3
|
+
:global(.utrecht-form-toggle__track) {
|
|
4
|
+
background-color: var(--utrecht-form-toggle-hover-background-color);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
}
|
package/src/toolTip/ToolTip.tsx
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ButtonHTMLAttributes,
|
|
3
|
-
type HTMLAttributes,
|
|
4
|
-
type HTMLProps,
|
|
5
|
-
type PropsWithChildren,
|
|
6
|
-
useId,
|
|
7
|
-
} from "react";
|
|
8
|
-
import Infobutton, { type InfoButtonProps } from "../infoButton/InfoButton";
|
|
9
|
-
import styles from "./styles.module.css";
|
|
10
|
-
|
|
11
|
-
interface ToolTipProps extends HTMLProps<HTMLButtonElement> {
|
|
12
|
-
id?: string;
|
|
13
|
-
className?: string;
|
|
14
|
-
text: string;
|
|
15
|
-
type?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
|
|
16
|
-
command?: InfoButtonProps["command"];
|
|
17
|
-
commandfor?: InfoButtonProps["commandfor"];
|
|
18
|
-
interestfor?: InfoButtonProps["interestfor"];
|
|
19
|
-
popover?: HTMLAttributes<HTMLDivElement>["popover"];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const ToolTip = (props: PropsWithChildren<ToolTipProps>) => {
|
|
23
|
-
const genId: string = useId();
|
|
24
|
-
const {
|
|
25
|
-
id = genId,
|
|
26
|
-
className,
|
|
27
|
-
text,
|
|
28
|
-
command = "toggle-popover",
|
|
29
|
-
commandfor = genId,
|
|
30
|
-
interestfor = genId,
|
|
31
|
-
popover = "manual",
|
|
32
|
-
children,
|
|
33
|
-
...restProps
|
|
34
|
-
} = props;
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<>
|
|
38
|
-
{children ? (
|
|
39
|
-
children
|
|
40
|
-
) : (
|
|
41
|
-
<Infobutton
|
|
42
|
-
interestfor={interestfor}
|
|
43
|
-
commandfor={commandfor}
|
|
44
|
-
command={command}
|
|
45
|
-
{...restProps}
|
|
46
|
-
/>
|
|
47
|
-
)}
|
|
48
|
-
<div className={styles.toolTip} id={id} popover={popover} role="tooltip">
|
|
49
|
-
{text}
|
|
50
|
-
</div>
|
|
51
|
-
</>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default ToolTip;
|
|
1
|
+
import {
|
|
2
|
+
type ButtonHTMLAttributes,
|
|
3
|
+
type HTMLAttributes,
|
|
4
|
+
type HTMLProps,
|
|
5
|
+
type PropsWithChildren,
|
|
6
|
+
useId,
|
|
7
|
+
} from "react";
|
|
8
|
+
import Infobutton, { type InfoButtonProps } from "../infoButton/InfoButton";
|
|
9
|
+
import styles from "./styles.module.css";
|
|
10
|
+
|
|
11
|
+
interface ToolTipProps extends HTMLProps<HTMLButtonElement> {
|
|
12
|
+
id?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
text: string;
|
|
15
|
+
type?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
|
|
16
|
+
command?: InfoButtonProps["command"];
|
|
17
|
+
commandfor?: InfoButtonProps["commandfor"];
|
|
18
|
+
interestfor?: InfoButtonProps["interestfor"];
|
|
19
|
+
popover?: HTMLAttributes<HTMLDivElement>["popover"];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ToolTip = (props: PropsWithChildren<ToolTipProps>) => {
|
|
23
|
+
const genId: string = useId();
|
|
24
|
+
const {
|
|
25
|
+
id = genId,
|
|
26
|
+
className,
|
|
27
|
+
text,
|
|
28
|
+
command = "toggle-popover",
|
|
29
|
+
commandfor = genId,
|
|
30
|
+
interestfor = genId,
|
|
31
|
+
popover = "manual",
|
|
32
|
+
children,
|
|
33
|
+
...restProps
|
|
34
|
+
} = props;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
{children ? (
|
|
39
|
+
children
|
|
40
|
+
) : (
|
|
41
|
+
<Infobutton
|
|
42
|
+
interestfor={interestfor}
|
|
43
|
+
commandfor={commandfor}
|
|
44
|
+
command={command}
|
|
45
|
+
{...restProps}
|
|
46
|
+
/>
|
|
47
|
+
)}
|
|
48
|
+
<div className={styles.toolTip} id={id} popover={popover} role="tooltip">
|
|
49
|
+
{text}
|
|
50
|
+
</div>
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default ToolTip;
|
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--don-tooltip-border-color: var(--rhc-color-cool-grey-300);
|
|
3
|
-
--don-tooltip-background-color: var(--rhc-color-cool-grey-50);
|
|
4
|
-
--don-tooltip-border-radius: var(--rhc-border-radius-md);
|
|
5
|
-
--don-tooltip-font-size: 0.875rem;
|
|
6
|
-
--don-tooltip-font-weigth: normal;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.triggerButton {
|
|
10
|
-
appearance: none;
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
background: none;
|
|
13
|
-
border: none;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.toolTip {
|
|
17
|
-
position-area: block-end span-all;
|
|
18
|
-
border: var(--don-tooltip-border-width, 1px) solid
|
|
19
|
-
var(--don-tooltip-border-color, #cbd5e1);
|
|
20
|
-
border-radius: var(--don-tooltip-border-radius, 5px);
|
|
21
|
-
background-color: var(--don-tooltip-background-color, #f8fafc);
|
|
22
|
-
box-shadow: 0 0 1px 2px rgb(127, 127, 127, 0.05);
|
|
23
|
-
font-size: var(--don-tooltip-font-size, inherit);
|
|
24
|
-
font-weight: var(--don-tooltip-font-weigth, normal);
|
|
25
|
-
padding-block: var(--don-tooltip-padding-block, 0.5rem);
|
|
26
|
-
padding-inline: var(
|
|
27
|
-
--don-tooltip-padding-inline,
|
|
28
|
-
var(--don-tooltip-padding-block, 0.5rem)
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
/* needed for triangle */
|
|
32
|
-
margin: 5px;
|
|
33
|
-
overflow: visible;
|
|
34
|
-
|
|
35
|
-
&::before {
|
|
36
|
-
content: '';
|
|
37
|
-
display: block;
|
|
38
|
-
position: absolute;
|
|
39
|
-
position-area: top;
|
|
40
|
-
top: -5px;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
border-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
1
|
+
:root {
|
|
2
|
+
--don-tooltip-border-color: var(--rhc-color-cool-grey-300);
|
|
3
|
+
--don-tooltip-background-color: var(--rhc-color-cool-grey-50);
|
|
4
|
+
--don-tooltip-border-radius: var(--rhc-border-radius-md);
|
|
5
|
+
--don-tooltip-font-size: 0.875rem;
|
|
6
|
+
--don-tooltip-font-weigth: normal;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.triggerButton {
|
|
10
|
+
appearance: none;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
background: none;
|
|
13
|
+
border: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.toolTip {
|
|
17
|
+
position-area: block-end span-all;
|
|
18
|
+
border: var(--don-tooltip-border-width, 1px) solid
|
|
19
|
+
var(--don-tooltip-border-color, #cbd5e1);
|
|
20
|
+
border-radius: var(--don-tooltip-border-radius, 5px);
|
|
21
|
+
background-color: var(--don-tooltip-background-color, #f8fafc);
|
|
22
|
+
box-shadow: 0 0 1px 2px rgb(127, 127, 127, 0.05);
|
|
23
|
+
font-size: var(--don-tooltip-font-size, inherit);
|
|
24
|
+
font-weight: var(--don-tooltip-font-weigth, normal);
|
|
25
|
+
padding-block: var(--don-tooltip-padding-block, 0.5rem);
|
|
26
|
+
padding-inline: var(
|
|
27
|
+
--don-tooltip-padding-inline,
|
|
28
|
+
var(--don-tooltip-padding-block, 0.5rem)
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
/* needed for triangle */
|
|
32
|
+
margin: 5px;
|
|
33
|
+
overflow: visible;
|
|
34
|
+
|
|
35
|
+
&::before {
|
|
36
|
+
content: '';
|
|
37
|
+
display: block;
|
|
38
|
+
position: absolute;
|
|
39
|
+
position-area: top;
|
|
40
|
+
top: -5px;
|
|
41
|
+
left: calc(50% - 5px);
|
|
42
|
+
width: 0;
|
|
43
|
+
height: 0;
|
|
44
|
+
border-left: 5px solid transparent;
|
|
45
|
+
border-right: 5px solid transparent;
|
|
46
|
+
|
|
47
|
+
border-bottom: 5px solid var(--don-tooltip-border-color, #cbd5e1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type IconProps,
|
|
3
|
-
NavBar,
|
|
4
|
-
type NavBarItemProps,
|
|
5
|
-
} from "@rijkshuisstijl-community/components-react";
|
|
6
|
-
import type { ReactElement } from "react";
|
|
7
|
-
import Icon from "../iconsSprite/Icon";
|
|
8
|
-
import styles from "./styles.module.css";
|
|
9
|
-
|
|
10
|
-
export interface NavBarItem {
|
|
11
|
-
id: string;
|
|
12
|
-
label: string;
|
|
13
|
-
href: string;
|
|
14
|
-
current?: boolean;
|
|
15
|
-
icon?: string | ReactElement<IconProps>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface TopNavigationProps {
|
|
19
|
-
items: Array<NavBarItem>;
|
|
20
|
-
endItems?: Array<NavBarItem>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const processIcon = (
|
|
24
|
-
icon: NavBarItem["icon"],
|
|
25
|
-
): ReactElement<IconProps> | undefined => {
|
|
26
|
-
if (typeof icon === "string") {
|
|
27
|
-
switch (icon) {
|
|
28
|
-
case "_add":
|
|
29
|
-
return <Icon name="plus-cirkel-inline" />;
|
|
30
|
-
case "_external":
|
|
31
|
-
return (
|
|
32
|
-
<Icon name="externe-link-inline" aria-label={`Externe link naar`} />
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
} else {
|
|
36
|
-
return icon;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const processNavBarItems = (
|
|
41
|
-
items: Array<NavBarItem>,
|
|
42
|
-
): NavBarItemProps[] => {
|
|
43
|
-
return items.map((item) => {
|
|
44
|
-
const { current, ...rest } = item;
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
...rest,
|
|
48
|
-
bold: current,
|
|
49
|
-
icon: processIcon(item.icon),
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default function TopNavigation({ items, endItems }: TopNavigationProps) {
|
|
55
|
-
const processedItems = processNavBarItems(items);
|
|
56
|
-
const processedEndItems = endItems && processNavBarItems(endItems);
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<div className={styles.container}>
|
|
60
|
-
<NavBar
|
|
61
|
-
items={processedItems}
|
|
62
|
-
endItems={processedEndItems}
|
|
63
|
-
className={styles.navbar}
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
type IconProps,
|
|
3
|
+
NavBar,
|
|
4
|
+
type NavBarItemProps,
|
|
5
|
+
} from "@rijkshuisstijl-community/components-react";
|
|
6
|
+
import type { ReactElement } from "react";
|
|
7
|
+
import Icon from "../iconsSprite/Icon";
|
|
8
|
+
import styles from "./styles.module.css";
|
|
9
|
+
|
|
10
|
+
export interface NavBarItem {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
href: string;
|
|
14
|
+
current?: boolean;
|
|
15
|
+
icon?: string | ReactElement<IconProps>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface TopNavigationProps {
|
|
19
|
+
items: Array<NavBarItem>;
|
|
20
|
+
endItems?: Array<NavBarItem>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const processIcon = (
|
|
24
|
+
icon: NavBarItem["icon"],
|
|
25
|
+
): ReactElement<IconProps> | undefined => {
|
|
26
|
+
if (typeof icon === "string") {
|
|
27
|
+
switch (icon) {
|
|
28
|
+
case "_add":
|
|
29
|
+
return <Icon name="plus-cirkel-inline" />;
|
|
30
|
+
case "_external":
|
|
31
|
+
return (
|
|
32
|
+
<Icon name="externe-link-inline" aria-label={`Externe link naar`} />
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
return icon;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const processNavBarItems = (
|
|
41
|
+
items: Array<NavBarItem>,
|
|
42
|
+
): NavBarItemProps[] => {
|
|
43
|
+
return items.map((item) => {
|
|
44
|
+
const { current, ...rest } = item;
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
...rest,
|
|
48
|
+
bold: current,
|
|
49
|
+
icon: processIcon(item.icon),
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default function TopNavigation({ items, endItems }: TopNavigationProps) {
|
|
55
|
+
const processedItems = processNavBarItems(items);
|
|
56
|
+
const processedEndItems = endItems && processNavBarItems(endItems);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div className={styles.container}>
|
|
60
|
+
<NavBar
|
|
61
|
+
items={processedItems}
|
|
62
|
+
endItems={processedEndItems}
|
|
63
|
+
className={styles.navbar}
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
/* border-block-end: 1px solid var(--rhc-nav-bar-border-color); */
|
|
3
|
-
margin-block-end: 1rem;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.navbar {
|
|
7
|
-
:global(.rhc-nav-bar__link) {
|
|
8
|
-
align-items: center;
|
|
9
|
-
:global(.don-icon-externe-link-inline) {
|
|
10
|
-
order: 1;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@media (--md-and-below-viewport) {
|
|
16
|
-
.navbar {
|
|
17
|
-
flex-wrap: wrap;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/* TODO: hamburger menu ? */
|
|
22
|
-
@media (--xs-and-below-viewport) {
|
|
23
|
-
.navbar.navbar {
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
align-items: stretch;
|
|
26
|
-
|
|
27
|
-
:global(.rhc-nav-bar__list) {
|
|
28
|
-
justify-content: center;
|
|
29
|
-
border-block-end: 1px solid var(--rhc-nav-bar-border-color);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
:global(.rhc-nav-bar__list--end) {
|
|
33
|
-
margin-inline-start: revert;
|
|
34
|
-
border-block-end: revert;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@media (--xxs-and-below-viewport) {
|
|
40
|
-
.navbar {
|
|
41
|
-
font-size: 0.875rem;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@media (--xxxs-viewport) {
|
|
46
|
-
.navbar {
|
|
47
|
-
font-size: 0.75rem;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* modifier style wasn't implemented in RHC */
|
|
52
|
-
:global(.rhc-nav-bar__link--bold) {
|
|
53
|
-
font-weight: bold;
|
|
54
|
-
}
|
|
1
|
+
.container {
|
|
2
|
+
/* border-block-end: 1px solid var(--rhc-nav-bar-border-color); */
|
|
3
|
+
margin-block-end: 1rem;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.navbar {
|
|
7
|
+
:global(.rhc-nav-bar__link) {
|
|
8
|
+
align-items: center;
|
|
9
|
+
:global(.don-icon-externe-link-inline) {
|
|
10
|
+
order: 1;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media (--md-and-below-viewport) {
|
|
16
|
+
.navbar {
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* TODO: hamburger menu ? */
|
|
22
|
+
@media (--xs-and-below-viewport) {
|
|
23
|
+
.navbar.navbar {
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: stretch;
|
|
26
|
+
|
|
27
|
+
:global(.rhc-nav-bar__list) {
|
|
28
|
+
justify-content: center;
|
|
29
|
+
border-block-end: 1px solid var(--rhc-nav-bar-border-color);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:global(.rhc-nav-bar__list--end) {
|
|
33
|
+
margin-inline-start: revert;
|
|
34
|
+
border-block-end: revert;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@media (--xxs-and-below-viewport) {
|
|
40
|
+
.navbar {
|
|
41
|
+
font-size: 0.875rem;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (--xxxs-viewport) {
|
|
46
|
+
.navbar {
|
|
47
|
+
font-size: 0.75rem;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* modifier style wasn't implemented in RHC */
|
|
52
|
+
:global(.rhc-nav-bar__link--bold) {
|
|
53
|
+
font-weight: bold;
|
|
54
|
+
}
|