@developer-overheid-nl/don-register-components 1.3.1 → 1.6.1
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 +170 -130
- package/LICENSE.md +291 -291
- package/README.md +20 -20
- package/package.json +10 -6
- package/src/Introduction.mdx +31 -0
- package/src/alert/Alert.stories.tsx +57 -0
- package/src/alert/Alert.tsx +19 -19
- package/src/alert/styles.module.css +3 -3
- package/src/alignBox/AlignBox.stories.tsx +84 -0
- package/src/alignBox/AlignBox.tsx +114 -114
- package/src/alignBox/styles.module.css +110 -110
- package/src/amountLabel/AmountLabel.stories.tsx +28 -0
- package/src/amountLabel/AmountLabel.tsx +21 -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.stories.tsx +53 -0
- package/src/article/Article.tsx +10 -10
- package/src/badgeList/BadgeList.tsx +34 -34
- package/src/badgeList/styles.module.css +37 -37
- package/src/block/Block.stories.tsx +58 -0
- package/src/block/Block.tsx +35 -35
- package/src/block/styles.module.css +29 -29
- package/src/button/Button.stories.tsx +56 -0
- package/src/button/Button.tsx +3 -3
- package/src/button/ButtonAction.stories.tsx +62 -0
- package/src/button/ButtonAction.tsx +51 -0
- package/src/cardAsLink/CardAsLink.stories.tsx +81 -0
- package/src/cardAsLink/CardAsLink.tsx +21 -21
- package/src/cardAsLink/styles.module.css +23 -23
- package/src/cardsList/CardsList.tsx +56 -56
- package/src/cardsList/styles.module.css +18 -19
- package/src/client.ts +7 -7
- package/src/container/Container.stories.tsx +21 -0
- package/src/container/Container.tsx +10 -10
- package/src/container/styles.module.css +28 -28
- package/src/copyButton/CopyButton.stories.tsx +41 -0
- package/src/copyButton/CopyButton.tsx +45 -39
- package/src/copyButton/styles.module.css +13 -13
- package/src/dataBadgeLink/DataBadgeLink.stories.tsx +137 -0
- package/src/dataBadgeLink/DataBadgeLink.tsx +59 -53
- package/src/dataBadgeLink/styles.module.css +89 -89
- 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.stories.tsx +93 -0
- package/src/facetFilters/FacetFilters.tsx +424 -419
- package/src/facetFilters/styles.module.css +3 -3
- package/src/fieldset/FieldSet.stories.tsx +45 -0
- package/src/fieldset/FieldSet.tsx +3 -3
- package/src/filters/Filters.stories.tsx +45 -0
- package/src/filters/Filters.tsx +116 -116
- package/src/filters/styles.module.css +26 -26
- package/src/footer/Footer.stories.tsx +127 -0
- package/src/footer/Footer.tsx +81 -76
- package/src/footer/styles.module.css +103 -103
- package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.stories.tsx +48 -0
- package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.tsx +16 -16
- package/src/formFieldCheckboxGroup/styles.module.css +5 -5
- package/src/formFieldCheckboxOption/FormFieldCheckboxOption.stories.tsx +61 -0
- package/src/formFieldCheckboxOption/FormFieldCheckboxOption.tsx +26 -26
- package/src/formFieldCheckboxOption/styles.module.css +22 -22
- package/src/formFieldLabel/FormFieldLabel.stories.tsx +21 -0
- package/src/formFieldLabel/FormFieldLabel.tsx +23 -23
- package/src/formFieldRadioGroup/FormFieldRadioGroup.stories.tsx +57 -0
- package/src/formFieldRadioGroup/FormFieldRadioGroup.tsx +13 -13
- package/src/formFieldRadioGroup/styles.module.css +5 -5
- package/src/formFieldRadioOption/FormFieldRadioOption.stories.tsx +48 -0
- package/src/formFieldRadioOption/FormFieldRadioOption.tsx +75 -75
- package/src/formFieldRadioOption/styles.module.css +49 -49
- package/src/formFieldSwitch/FormFieldSwitch.stories.tsx +61 -0
- package/src/formFieldSwitch/FormFieldSwitch.tsx +82 -79
- package/src/formFieldSwitch/styles.module.css +32 -32
- package/src/formFieldTextInput/FormFieldTextInput.stories.tsx +45 -0
- package/src/formFieldTextInput/FormFieldTextInput.tsx +3 -3
- package/src/grid/Grid.stories.tsx +37 -0
- package/src/grid/Grid.tsx +48 -0
- package/src/grid/styles.module.css +24 -0
- package/src/header/Header.stories.tsx +54 -0
- package/src/header/Header.tsx +137 -137
- package/src/header/styles.module.css +71 -71
- package/src/heading/Heading.stories.tsx +60 -0
- package/src/heading/Heading.tsx +15 -15
- package/src/headingGroup/HeadingGroup.stories.tsx +57 -0
- package/src/headingGroup/HeadingGroup.tsx +48 -48
- package/src/headingGroup/styles.module.css +3 -3
- package/src/i18n.ts +24 -25
- package/src/iconBadge/IconBadge.stories.tsx +46 -0
- 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.stories.tsx +73 -0
- package/src/iconsSprite/Icon.tsx +17 -17
- package/src/iconsSprite/IconsSprite.tsx +5 -5
- package/src/index.ts +117 -107
- package/src/infoButton/InfoButton.stories.tsx +52 -0
- package/src/infoButton/InfoButton.tsx +45 -45
- package/src/infoButton/styles.module.css +43 -43
- package/src/link/Link.stories.tsx +49 -0
- package/src/link/Link.tsx +10 -10
- package/src/markdown/Markdown.stories.tsx +48 -0
- package/src/markdown/Markdown.tsx +42 -42
- package/src/overlay/Overlay.stories.tsx +38 -0
- package/src/overlay/Overlay.tsx +18 -18
- package/src/overlay/styles.module.css +15 -15
- package/src/pagination/Pagination.stories.tsx +91 -0
- package/src/pagination/Pagination.tsx +267 -267
- package/src/pagination/styles.module.css +28 -28
- package/src/paragraph/Paragraph.stories.tsx +45 -0
- 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.stories.tsx +257 -0
- package/src/pillBadge/PillBadge.tsx +60 -51
- package/src/pillBadge/styles.module.css +214 -214
- package/src/readOnlyTextInput/ReadOnlyTextInput.stories.tsx +49 -0
- package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
- package/src/readOnlyTextInput/styles.module.css +19 -19
- package/src/scoreBadge/ScoreBadge.stories.tsx +45 -0
- package/src/scoreBadge/ScoreBadge.tsx +135 -133
- package/src/search/Search.stories.tsx +65 -0
- package/src/search/Search.tsx +82 -82
- package/src/search/styles.module.css +40 -39
- package/src/siteLogo/ExampleLogo.stories.tsx +40 -0
- package/src/siteLogo/SiteLogo.stories.tsx +28 -0
- package/src/siteLogo/SiteLogo.tsx +24 -24
- package/src/sortForm/SortForm.stories.tsx +111 -0
- package/src/sortForm/SortForm.tsx +121 -0
- package/src/sortForm/styles.module.css +40 -0
- package/src/switch/Switch.stories.tsx +68 -0
- package/src/switch/Switch.tsx +152 -86
- package/src/switch/styles.module.css +54 -7
- package/src/toolTip/ToolTip.stories.tsx +131 -0
- package/src/toolTip/ToolTip.tsx +55 -55
- package/src/toolTip/styles.module.css +49 -49
- package/src/topNavigation/TopNavigation.stories.tsx +71 -0
- package/src/topNavigation/TopNavigation.tsx +67 -67
- package/src/topNavigation/styles.module.css +54 -54
- package/tsconfig.json +122 -121
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.grid {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: repeat(
|
|
4
|
+
auto-fill,
|
|
5
|
+
minmax(var(--grid-min-column-width, 8rem), 1fr)
|
|
6
|
+
);
|
|
7
|
+
align-items: start;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.gapNone {
|
|
11
|
+
gap: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.gapSmall {
|
|
15
|
+
gap: 0.5rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.gapMedium {
|
|
19
|
+
gap: 1rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.gapLarge {
|
|
23
|
+
gap: 2rem;
|
|
24
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import Header from "./Header";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Header toont de sitekop met logo en sitetitel. Het link-gedrag van het
|
|
6
|
+
* logo (`logoLinkBehaviour`) bepaalt of het terugverwijst naar de hoofdsite,
|
|
7
|
+
* de homepage van deze site, of helemaal geen link is, en houdt daarbij
|
|
8
|
+
* rekening met of de bezoeker al op de homepage is.
|
|
9
|
+
*/
|
|
10
|
+
const meta = {
|
|
11
|
+
title: "Components/Header",
|
|
12
|
+
component: Header,
|
|
13
|
+
tags: ["autodocs", "custom"],
|
|
14
|
+
argTypes: {
|
|
15
|
+
logoLinkBehaviour: {
|
|
16
|
+
control: "select",
|
|
17
|
+
options: ["site-home", "main-site", "main-site-on-home", "no-link"],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
titleSite: "API-register",
|
|
22
|
+
titlePage: "Overzicht",
|
|
23
|
+
mainSite: {
|
|
24
|
+
name: "developer.overheid.nl",
|
|
25
|
+
url: "https://developer.overheid.nl",
|
|
26
|
+
},
|
|
27
|
+
urlHomepage: ["/", "/apis/pagina/[...page]"],
|
|
28
|
+
urlCurrent: "/apis/toevoegen",
|
|
29
|
+
logoLinkBehaviour: "main-site-on-home",
|
|
30
|
+
},
|
|
31
|
+
} satisfies Meta<typeof Header>;
|
|
32
|
+
|
|
33
|
+
export default meta;
|
|
34
|
+
type Story = StoryObj<typeof meta>;
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {};
|
|
37
|
+
|
|
38
|
+
export const OnHomepage: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
urlCurrent: "/",
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const AlwaysLinkToMainSite: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
logoLinkBehaviour: "main-site",
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const NoLogoLink: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
logoLinkBehaviour: "no-link",
|
|
53
|
+
},
|
|
54
|
+
};
|
package/src/header/Header.tsx
CHANGED
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
import { Lint } from "@developer-overheid-nl/proprietary";
|
|
2
|
-
import {
|
|
3
|
-
Heading /*, Link */,
|
|
4
|
-
} from "@rijkshuisstijl-community/components-react";
|
|
5
|
-
import { I18nextProvider, useTranslation } from "react-i18next";
|
|
6
|
-
import i18n from "../i18n";
|
|
7
|
-
import SiteLogo from "../siteLogo/SiteLogo";
|
|
8
|
-
import styles from "./styles.module.css";
|
|
9
|
-
// import { IconDeltaNaarLinksInline } from "../../../../proprietary/icons";
|
|
10
|
-
|
|
11
|
-
export interface HeaderProps extends LogoNavProps {
|
|
12
|
-
titleSite: string;
|
|
13
|
-
titlePage: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface LogoNavProps {
|
|
17
|
-
mainSite: { name: string; url: string };
|
|
18
|
-
urlCurrent?: string;
|
|
19
|
-
/**
|
|
20
|
-
* routePattern(s) that are considered hompages, e.g. `/`, `/apis`, `/apis/[...pages]`
|
|
21
|
-
* The first item in the array will be used for the homepage link.
|
|
22
|
-
*
|
|
23
|
-
* @type string[]
|
|
24
|
-
*/
|
|
25
|
-
urlHomepage?: string[];
|
|
26
|
-
/**
|
|
27
|
-
* How the link around the logo should behave.
|
|
28
|
-
* - `no-link`: always no link around the logo
|
|
29
|
-
* - `site-home`: (default) a link around the logo that links back to this site, no link on hompeage
|
|
30
|
-
* - `main-site`: a link around the logo that links always back to the main site
|
|
31
|
-
* - `main-site-on-home`: a link around the logo that links back to this site's homepage, but on the homepage links back to the main site
|
|
32
|
-
*
|
|
33
|
-
* Note: translation keys: `components.back-to-homepage-landmark`, ...
|
|
34
|
-
*/
|
|
35
|
-
logoLinkBehaviour?:
|
|
36
|
-
| "no-link"
|
|
37
|
-
| "site-home"
|
|
38
|
-
| "main-site"
|
|
39
|
-
| "main-site-on-home";
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function LogoNav(props: LogoNavProps) {
|
|
43
|
-
const { t } = useTranslation();
|
|
44
|
-
const {
|
|
45
|
-
mainSite,
|
|
46
|
-
urlCurrent = "/",
|
|
47
|
-
urlHomepage = ["/"],
|
|
48
|
-
logoLinkBehaviour,
|
|
49
|
-
} = props;
|
|
50
|
-
let isRoot: boolean = urlHomepage.includes(urlCurrent);
|
|
51
|
-
let href: string = "/";
|
|
52
|
-
let landmark: string | undefined;
|
|
53
|
-
let title: string | undefined;
|
|
54
|
-
|
|
55
|
-
switch (logoLinkBehaviour) {
|
|
56
|
-
case "no-link":
|
|
57
|
-
isRoot = true;
|
|
58
|
-
break;
|
|
59
|
-
case "main-site":
|
|
60
|
-
isRoot = false;
|
|
61
|
-
href = mainSite.url;
|
|
62
|
-
landmark = t("components.back-to-main-site-landmark", {
|
|
63
|
-
siteName: mainSite.name,
|
|
64
|
-
});
|
|
65
|
-
break;
|
|
66
|
-
case "main-site-on-home":
|
|
67
|
-
href = isRoot ? mainSite.url : urlHomepage[0] || "/";
|
|
68
|
-
landmark = isRoot
|
|
69
|
-
? t("components.back-to-main-site-landmark", {
|
|
70
|
-
siteName: mainSite.name,
|
|
71
|
-
})
|
|
72
|
-
: t("components.back-to-homepage-landmark");
|
|
73
|
-
title = isRoot
|
|
74
|
-
? t("components.back-to-main-site", { siteName: mainSite.name })
|
|
75
|
-
: t("components.back-to-homepage");
|
|
76
|
-
isRoot = false;
|
|
77
|
-
break;
|
|
78
|
-
default:
|
|
79
|
-
href = urlHomepage[0] || "/";
|
|
80
|
-
landmark = isRoot ? undefined : t("components.back-to-homepage-landmark");
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return landmark ? (
|
|
85
|
-
<nav aria-label={landmark} title={title}>
|
|
86
|
-
<SiteLogo isRoot={isRoot} href={href} />
|
|
87
|
-
</nav>
|
|
88
|
-
) : (
|
|
89
|
-
<div className="nav">
|
|
90
|
-
<SiteLogo isRoot={isRoot} href={href} />
|
|
91
|
-
</div>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function Header({
|
|
96
|
-
titleSite,
|
|
97
|
-
titlePage,
|
|
98
|
-
mainSite,
|
|
99
|
-
urlCurrent,
|
|
100
|
-
urlHomepage,
|
|
101
|
-
logoLinkBehaviour,
|
|
102
|
-
}: HeaderProps) {
|
|
103
|
-
// const { t } = useTranslation();
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<header className={styles.header}>
|
|
107
|
-
<LogoNav
|
|
108
|
-
mainSite={mainSite}
|
|
109
|
-
urlCurrent={urlCurrent}
|
|
110
|
-
urlHomepage={urlHomepage}
|
|
111
|
-
logoLinkBehaviour={logoLinkBehaviour}
|
|
112
|
-
/>
|
|
113
|
-
<Lint className={styles.lint} />
|
|
114
|
-
<div className={styles.title}>
|
|
115
|
-
<Heading level={1} appearanceLevel={3} className={styles.heading}>
|
|
116
|
-
{titleSite}
|
|
117
|
-
<span className="sr-only">: {titlePage}</span>
|
|
118
|
-
</Heading>
|
|
119
|
-
{/* TODO: uncomment and update component if backlink here is still needed... */}
|
|
120
|
-
{/* <nav aria-label={t('components.back-to-main-site-landmark')}>
|
|
121
|
-
<Link href={mainSite.url} className={styles.link}>
|
|
122
|
-
<IconDeltaNaarLinksInline className={styles.icon} />
|
|
123
|
-
{t('components.back-to-main-site', { siteName: mainSite.name })}
|
|
124
|
-
</Link>
|
|
125
|
-
</nav> */}
|
|
126
|
-
</div>
|
|
127
|
-
</header>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export default function TranslatedHeader(props: HeaderProps) {
|
|
132
|
-
return (
|
|
133
|
-
<I18nextProvider i18n={i18n}>
|
|
134
|
-
<Header {...props} />
|
|
135
|
-
</I18nextProvider>
|
|
136
|
-
);
|
|
137
|
-
}
|
|
1
|
+
import { Lint } from "@developer-overheid-nl/proprietary";
|
|
2
|
+
import {
|
|
3
|
+
Heading /*, Link */,
|
|
4
|
+
} from "@rijkshuisstijl-community/components-react";
|
|
5
|
+
import { I18nextProvider, useTranslation } from "react-i18next";
|
|
6
|
+
import i18n from "../i18n";
|
|
7
|
+
import SiteLogo from "../siteLogo/SiteLogo";
|
|
8
|
+
import styles from "./styles.module.css";
|
|
9
|
+
// import { IconDeltaNaarLinksInline } from "../../../../proprietary/icons";
|
|
10
|
+
|
|
11
|
+
export interface HeaderProps extends LogoNavProps {
|
|
12
|
+
titleSite: string;
|
|
13
|
+
titlePage: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface LogoNavProps {
|
|
17
|
+
mainSite: { name: string; url: string };
|
|
18
|
+
urlCurrent?: string;
|
|
19
|
+
/**
|
|
20
|
+
* routePattern(s) that are considered hompages, e.g. `/`, `/apis`, `/apis/[...pages]`
|
|
21
|
+
* The first item in the array will be used for the homepage link.
|
|
22
|
+
*
|
|
23
|
+
* @type string[]
|
|
24
|
+
*/
|
|
25
|
+
urlHomepage?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* How the link around the logo should behave.
|
|
28
|
+
* - `no-link`: always no link around the logo
|
|
29
|
+
* - `site-home`: (default) a link around the logo that links back to this site, no link on hompeage
|
|
30
|
+
* - `main-site`: a link around the logo that links always back to the main site
|
|
31
|
+
* - `main-site-on-home`: a link around the logo that links back to this site's homepage, but on the homepage links back to the main site
|
|
32
|
+
*
|
|
33
|
+
* Note: translation keys: `components.back-to-homepage-landmark`, ...
|
|
34
|
+
*/
|
|
35
|
+
logoLinkBehaviour?:
|
|
36
|
+
| "no-link"
|
|
37
|
+
| "site-home"
|
|
38
|
+
| "main-site"
|
|
39
|
+
| "main-site-on-home";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function LogoNav(props: LogoNavProps) {
|
|
43
|
+
const { t } = useTranslation();
|
|
44
|
+
const {
|
|
45
|
+
mainSite,
|
|
46
|
+
urlCurrent = "/",
|
|
47
|
+
urlHomepage = ["/"],
|
|
48
|
+
logoLinkBehaviour,
|
|
49
|
+
} = props;
|
|
50
|
+
let isRoot: boolean = urlHomepage.includes(urlCurrent);
|
|
51
|
+
let href: string = "/";
|
|
52
|
+
let landmark: string | undefined;
|
|
53
|
+
let title: string | undefined;
|
|
54
|
+
|
|
55
|
+
switch (logoLinkBehaviour) {
|
|
56
|
+
case "no-link":
|
|
57
|
+
isRoot = true;
|
|
58
|
+
break;
|
|
59
|
+
case "main-site":
|
|
60
|
+
isRoot = false;
|
|
61
|
+
href = mainSite.url;
|
|
62
|
+
landmark = t("components.back-to-main-site-landmark", {
|
|
63
|
+
siteName: mainSite.name,
|
|
64
|
+
});
|
|
65
|
+
break;
|
|
66
|
+
case "main-site-on-home":
|
|
67
|
+
href = isRoot ? mainSite.url : urlHomepage[0] || "/";
|
|
68
|
+
landmark = isRoot
|
|
69
|
+
? t("components.back-to-main-site-landmark", {
|
|
70
|
+
siteName: mainSite.name,
|
|
71
|
+
})
|
|
72
|
+
: t("components.back-to-homepage-landmark");
|
|
73
|
+
title = isRoot
|
|
74
|
+
? t("components.back-to-main-site", { siteName: mainSite.name })
|
|
75
|
+
: t("components.back-to-homepage");
|
|
76
|
+
isRoot = false;
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
href = urlHomepage[0] || "/";
|
|
80
|
+
landmark = isRoot ? undefined : t("components.back-to-homepage-landmark");
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return landmark ? (
|
|
85
|
+
<nav aria-label={landmark} title={title}>
|
|
86
|
+
<SiteLogo isRoot={isRoot} href={href} />
|
|
87
|
+
</nav>
|
|
88
|
+
) : (
|
|
89
|
+
<div className="nav">
|
|
90
|
+
<SiteLogo isRoot={isRoot} href={href} />
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function Header({
|
|
96
|
+
titleSite,
|
|
97
|
+
titlePage,
|
|
98
|
+
mainSite,
|
|
99
|
+
urlCurrent,
|
|
100
|
+
urlHomepage,
|
|
101
|
+
logoLinkBehaviour,
|
|
102
|
+
}: HeaderProps) {
|
|
103
|
+
// const { t } = useTranslation();
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<header className={styles.header}>
|
|
107
|
+
<LogoNav
|
|
108
|
+
mainSite={mainSite}
|
|
109
|
+
urlCurrent={urlCurrent}
|
|
110
|
+
urlHomepage={urlHomepage}
|
|
111
|
+
logoLinkBehaviour={logoLinkBehaviour}
|
|
112
|
+
/>
|
|
113
|
+
<Lint className={styles.lint} />
|
|
114
|
+
<div className={styles.title}>
|
|
115
|
+
<Heading level={1} appearanceLevel={3} className={styles.heading}>
|
|
116
|
+
{titleSite}
|
|
117
|
+
<span className="sr-only">: {titlePage}</span>
|
|
118
|
+
</Heading>
|
|
119
|
+
{/* TODO: uncomment and update component if backlink here is still needed... */}
|
|
120
|
+
{/* <nav aria-label={t('components.back-to-main-site-landmark')}>
|
|
121
|
+
<Link href={mainSite.url} className={styles.link}>
|
|
122
|
+
<IconDeltaNaarLinksInline className={styles.icon} />
|
|
123
|
+
{t('components.back-to-main-site', { siteName: mainSite.name })}
|
|
124
|
+
</Link>
|
|
125
|
+
</nav> */}
|
|
126
|
+
</div>
|
|
127
|
+
</header>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export default function TranslatedHeader(props: HeaderProps) {
|
|
132
|
+
return (
|
|
133
|
+
<I18nextProvider i18n={i18n}>
|
|
134
|
+
<Header {...props} />
|
|
135
|
+
</I18nextProvider>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
.header {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
justify-content: space-between;
|
|
5
|
-
padding-block: 0 0.5rem;
|
|
6
|
-
|
|
7
|
-
> * {
|
|
8
|
-
flex-basis: 33.3333%;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@media (--xxs-and-below-viewport) {
|
|
13
|
-
.header {
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
|
|
16
|
-
> * {
|
|
17
|
-
flex-basis: auto;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@media (--xs-and-below-viewport) {
|
|
23
|
-
.header {
|
|
24
|
-
flex-wrap: wrap;
|
|
25
|
-
row-gap: 0.5rem;
|
|
26
|
-
|
|
27
|
-
> * {
|
|
28
|
-
flex-basis: auto;
|
|
29
|
-
order: 2;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.lint {
|
|
34
|
-
flex-basis: 100%;
|
|
35
|
-
order: 1;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.title {
|
|
40
|
-
margin-inline-start: 1rem;
|
|
41
|
-
text-align: end;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.heading {
|
|
45
|
-
margin: 0;
|
|
46
|
-
margin-block-end: 0.5rem;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.icon {
|
|
50
|
-
inline-size: 0.875rem;
|
|
51
|
-
block-size: 0.875rem;
|
|
52
|
-
fill: currentColor;
|
|
53
|
-
transition: all 0.25s ease-in-out;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.link.link:any-link {
|
|
57
|
-
align-items: center;
|
|
58
|
-
text-decoration-line: none;
|
|
59
|
-
transition: all 0.25s ease-in-out;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.link.link:any-link:hover {
|
|
63
|
-
text-decoration-line: underline;
|
|
64
|
-
text-decoration-skip-ink: auto;
|
|
65
|
-
/* biome-ignore lint/suspicious/noDuplicateProperties: ↰ first skip-ink needed for Chromium browsers, otherwise .nl-link `none` is used */
|
|
66
|
-
text-decoration-skip-ink: all; /* bugged in Chromium */
|
|
67
|
-
|
|
68
|
-
.icon {
|
|
69
|
-
transform: translateX(-0.0625rem);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
1
|
+
.header {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
padding-block: 0 0.5rem;
|
|
6
|
+
|
|
7
|
+
> * {
|
|
8
|
+
flex-basis: 33.3333%;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@media (--xxs-and-below-viewport) {
|
|
13
|
+
.header {
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
|
|
16
|
+
> * {
|
|
17
|
+
flex-basis: auto;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (--xs-and-below-viewport) {
|
|
23
|
+
.header {
|
|
24
|
+
flex-wrap: wrap;
|
|
25
|
+
row-gap: 0.5rem;
|
|
26
|
+
|
|
27
|
+
> * {
|
|
28
|
+
flex-basis: auto;
|
|
29
|
+
order: 2;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.lint {
|
|
34
|
+
flex-basis: 100%;
|
|
35
|
+
order: 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.title {
|
|
40
|
+
margin-inline-start: 1rem;
|
|
41
|
+
text-align: end;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.heading {
|
|
45
|
+
margin: 0;
|
|
46
|
+
margin-block-end: 0.5rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.icon {
|
|
50
|
+
inline-size: 0.875rem;
|
|
51
|
+
block-size: 0.875rem;
|
|
52
|
+
fill: currentColor;
|
|
53
|
+
transition: all 0.25s ease-in-out;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.link.link:any-link {
|
|
57
|
+
align-items: center;
|
|
58
|
+
text-decoration-line: none;
|
|
59
|
+
transition: all 0.25s ease-in-out;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.link.link:any-link:hover {
|
|
63
|
+
text-decoration-line: underline;
|
|
64
|
+
text-decoration-skip-ink: auto;
|
|
65
|
+
/* biome-ignore lint/suspicious/noDuplicateProperties: ↰ first skip-ink needed for Chromium browsers, otherwise .nl-link `none` is used */
|
|
66
|
+
text-decoration-skip-ink: all; /* bugged in Chromium */
|
|
67
|
+
|
|
68
|
+
.icon {
|
|
69
|
+
transform: translateX(-0.0625rem);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import Heading from "./Heading";
|
|
3
|
+
|
|
4
|
+
const headingLevels = [1, 2, 3, 4, 5] as const;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Headings worden gebruikt voor titels in de tekstuele hiërarchie van de content.
|
|
8
|
+
* Het rendert een HTML `<h1>`...`<h6>`-element.
|
|
9
|
+
*
|
|
10
|
+
* - **level**: wijzigt de HTML-tag naar het overeenkomende niveau.
|
|
11
|
+
* - **appearanceLevel** (optioneel): verandert het uiterlijk, niet het `level`.
|
|
12
|
+
*/
|
|
13
|
+
const meta = {
|
|
14
|
+
title: "Components/Heading",
|
|
15
|
+
component: Heading,
|
|
16
|
+
tags: ["autodocs", "re-export"],
|
|
17
|
+
argTypes: {
|
|
18
|
+
level: {
|
|
19
|
+
control: "select",
|
|
20
|
+
options: headingLevels,
|
|
21
|
+
},
|
|
22
|
+
appearanceLevel: {
|
|
23
|
+
control: "select",
|
|
24
|
+
options: headingLevels,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
args: {
|
|
28
|
+
level: 1,
|
|
29
|
+
children: "API-register",
|
|
30
|
+
},
|
|
31
|
+
} satisfies Meta<typeof Heading>;
|
|
32
|
+
|
|
33
|
+
export default meta;
|
|
34
|
+
type Story = StoryObj<typeof meta>;
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {};
|
|
37
|
+
|
|
38
|
+
export const DecoupledAppearance: Story = {
|
|
39
|
+
name: "Semantisch niveau los van weergave",
|
|
40
|
+
args: {
|
|
41
|
+
level: 2,
|
|
42
|
+
appearanceLevel: 5,
|
|
43
|
+
children: "Organisatie",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const AllLevels: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
children: "",
|
|
50
|
+
},
|
|
51
|
+
render: () => (
|
|
52
|
+
<>
|
|
53
|
+
{headingLevels.map((level) => (
|
|
54
|
+
<Heading key={level} level={level}>
|
|
55
|
+
Kop niveau {level}
|
|
56
|
+
</Heading>
|
|
57
|
+
))}
|
|
58
|
+
</>
|
|
59
|
+
),
|
|
60
|
+
};
|
package/src/heading/Heading.tsx
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type HeadingProps,
|
|
3
|
-
Heading as RHCHeading,
|
|
4
|
-
} from "@rijkshuisstijl-community/components-react";
|
|
5
|
-
|
|
6
|
-
export type { HeadingProps } from "@rijkshuisstijl-community/components-react";
|
|
7
|
-
|
|
8
|
-
export const clampHeadingLevel = (headingLevel: number) =>
|
|
9
|
-
Math.max(1, Math.min(headingLevel
|
|
10
|
-
|
|
11
|
-
const Heading = (props: HeadingProps) => {
|
|
12
|
-
return <RHCHeading {...props} />;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default Heading;
|
|
1
|
+
import {
|
|
2
|
+
type HeadingProps,
|
|
3
|
+
Heading as RHCHeading,
|
|
4
|
+
} from "@rijkshuisstijl-community/components-react";
|
|
5
|
+
|
|
6
|
+
export type { HeadingProps } from "@rijkshuisstijl-community/components-react";
|
|
7
|
+
|
|
8
|
+
export const clampHeadingLevel = (headingLevel: number) =>
|
|
9
|
+
Math.max(1, Math.min(headingLevel, 5)) as HeadingProps["level"];
|
|
10
|
+
|
|
11
|
+
const Heading = (props: HeadingProps) => {
|
|
12
|
+
return <RHCHeading {...props} />;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default Heading;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import DataBadgeLink from "../dataBadgeLink/DataBadgeLink";
|
|
3
|
+
import HeadingGroup from "./HeadingGroup";
|
|
4
|
+
|
|
5
|
+
const headingLevels = [1, 2, 3, 4, 5] as const;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* HeadingGroup combineert een kop met een optionele subtitel, bijvoorbeeld
|
|
9
|
+
* de naam van een API met daaronder de beherende organisatie.
|
|
10
|
+
*
|
|
11
|
+
* ## Wijzigingen tov RHC:
|
|
12
|
+
* - Voegt `title`- en `subTitle`-props toe in plaats van losse
|
|
13
|
+
* `Heading`/`Paragraph`-children; een string-`subTitle` wordt automatisch
|
|
14
|
+
* in een `Paragraph` gezet, andere content (bijv. een badge) direct
|
|
15
|
+
* doorgegeven.
|
|
16
|
+
*/
|
|
17
|
+
const meta = {
|
|
18
|
+
title: "Components/HeadingGroup",
|
|
19
|
+
component: HeadingGroup,
|
|
20
|
+
tags: ["autodocs", "remixed"],
|
|
21
|
+
argTypes: {
|
|
22
|
+
level: {
|
|
23
|
+
control: "select",
|
|
24
|
+
options: headingLevels,
|
|
25
|
+
},
|
|
26
|
+
appearanceLevel: {
|
|
27
|
+
control: "select",
|
|
28
|
+
options: headingLevels,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
args: {
|
|
32
|
+
title: "Basisregistratie Adressen en Gebouwen API",
|
|
33
|
+
level: 2,
|
|
34
|
+
appearanceLevel: 4,
|
|
35
|
+
},
|
|
36
|
+
} satisfies Meta<typeof HeadingGroup>;
|
|
37
|
+
|
|
38
|
+
export default meta;
|
|
39
|
+
type Story = StoryObj<typeof meta>;
|
|
40
|
+
|
|
41
|
+
export const Default: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
subTitle: "Kadaster",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const WithBadgeSubtitle: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
subTitle: (
|
|
50
|
+
<DataBadgeLink appearance="subtle" href="/apis?organisation=kadaster">
|
|
51
|
+
Kadaster
|
|
52
|
+
</DataBadgeLink>
|
|
53
|
+
),
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const WithoutSubtitle: Story = {};
|