@developer-overheid-nl/don-register-components 1.0.0 → 1.1.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 +43 -0
- package/LICENSE.md +291 -291
- package/README.md +20 -20
- package/package.json +10 -7
- package/src/alert/Alert.tsx +19 -19
- package/src/alert/styles.module.css +3 -3
- package/src/alignBox/AlignBox.tsx +111 -110
- package/src/alignBox/styles.module.css +106 -106
- package/src/analytics/PiwikPro.tsx +72 -0
- package/src/analytics/index.ts +1 -0
- package/src/article/Article.tsx +10 -10
- 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 +2 -2
- 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 +50 -50
- package/src/dataBadgeLink/styles.module.css +43 -43
- package/src/dataSummary/DataSummary.tsx +22 -22
- package/src/dataSummary/DataSummaryItem.tsx +21 -21
- package/src/dataSummary/styles.module.css +70 -70
- package/src/fieldset/FieldSet.tsx +3 -3
- package/src/filters/Filters.tsx +115 -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/formFieldLabel/FormFieldLabel.tsx +23 -23
- 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 +10 -10
- package/src/headingGroup/HeadingGroup.tsx +48 -48
- package/src/headingGroup/styles.module.css +3 -3
- package/src/i18n.ts +25 -24
- package/src/iconBadge/IconBadge.tsx +32 -32
- package/src/iconBadge/getAppearance.ts +47 -47
- 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 +80 -80
- package/src/link/Link.tsx +10 -10
- package/src/markdown/Markdown.tsx +42 -42
- package/src/pagination/Pagination.tsx +144 -144
- package/src/pagination/styles.module.css +13 -13
- package/src/paragraph/Paragraph.tsx +10 -10
- package/src/pillBadge/PillBadge.examples.tsx +107 -107
- package/src/pillBadge/PillBadge.tsx +51 -51
- package/src/pillBadge/styles.module.css +194 -194
- package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
- package/src/readOnlyTextInput/styles.module.css +19 -19
- package/src/scoreBadge/ScoreBadge.tsx +132 -132
- package/src/search/Search.tsx +66 -66
- package/src/search/styles.module.css +39 -39
- package/src/siteLogo/SiteLogo.tsx +24 -24
- package/src/topNavigation/TopNavigation.tsx +67 -64
- package/src/topNavigation/styles.module.css +54 -54
- package/tsconfig.json +121 -121
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import type { ElementType, HTMLAttributes, PropsWithChildren } from "react";
|
|
3
|
-
import { I18nextProvider, useTranslation } from "react-i18next";
|
|
4
|
-
import i18n from "../i18n";
|
|
5
|
-
import styles from "./styles.module.css";
|
|
6
|
-
|
|
7
|
-
interface PageLinkProps
|
|
8
|
-
extends Omit<
|
|
9
|
-
HTMLAttributes<HTMLAnchorElement> & HTMLAttributes<HTMLSpanElement>,
|
|
10
|
-
"onAbort"
|
|
11
|
-
> {
|
|
12
|
-
href: string;
|
|
13
|
-
label: number | string;
|
|
14
|
-
range?: [number, number];
|
|
15
|
-
index: number;
|
|
16
|
-
current: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface RelativeLinkProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
20
|
-
href: string;
|
|
21
|
-
position: "prev" | "next";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface PaginationProps extends HTMLAttributes<HTMLElement> {
|
|
25
|
-
links: Array<{
|
|
26
|
-
href: PageLinkProps["href"];
|
|
27
|
-
label: PageLinkProps["label"];
|
|
28
|
-
/** Range of shown items on this page; [begin, end] */
|
|
29
|
-
range?: PageLinkProps["range"];
|
|
30
|
-
}>;
|
|
31
|
-
current?: PageLinkProps["current"];
|
|
32
|
-
prev?: string | false;
|
|
33
|
-
next?: string | false;
|
|
34
|
-
className?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const PageLink = (props: PageLinkProps) => {
|
|
38
|
-
const { t } = useTranslation();
|
|
39
|
-
const { href, label, range, index, current, ...restProps } = props;
|
|
40
|
-
const isCurrent = index === current;
|
|
41
|
-
const element = !isCurrent ? "a" : "span";
|
|
42
|
-
const hrefAttr = !isCurrent && { href };
|
|
43
|
-
const count =
|
|
44
|
-
(range && (range[0] === range[1] ? 1 : range[1] - range[0])) || 0;
|
|
45
|
-
|
|
46
|
-
const Element = element as ElementType<
|
|
47
|
-
HTMLAttributes<HTMLAnchorElement | HTMLSpanElement>
|
|
48
|
-
>;
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Element
|
|
52
|
-
className={clsx(
|
|
53
|
-
"utrecht-pagination__page-link",
|
|
54
|
-
isCurrent && "utrecht-pagination__page-link--current",
|
|
55
|
-
)}
|
|
56
|
-
{...hrefAttr}
|
|
57
|
-
aria-current={isCurrent}
|
|
58
|
-
aria-label={
|
|
59
|
-
range && t(`components.page-and-results-range`, { label, range, count })
|
|
60
|
-
}
|
|
61
|
-
title={range && t(`components.results-range`, { range, count })}
|
|
62
|
-
{...restProps}
|
|
63
|
-
>
|
|
64
|
-
{label}
|
|
65
|
-
</Element>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const RelativeLink = (props: RelativeLinkProps) => {
|
|
70
|
-
const { t } = useTranslation();
|
|
71
|
-
const { href, position } = props;
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<a
|
|
75
|
-
href={href}
|
|
76
|
-
className={clsx(
|
|
77
|
-
"utrecht-pagination__relative-link",
|
|
78
|
-
"utrecht-pagination__relative-link--disabled",
|
|
79
|
-
`utrecht-pagination__relative-link--${position}`,
|
|
80
|
-
)}
|
|
81
|
-
rel={position}
|
|
82
|
-
>
|
|
83
|
-
{t(`components.${position}`)}
|
|
84
|
-
</a>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const Pagination = (props: PropsWithChildren<PaginationProps>) => {
|
|
89
|
-
const { t } = useTranslation();
|
|
90
|
-
const { links, current = 0, prev, next, className } = props;
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<nav
|
|
94
|
-
className={clsx(
|
|
95
|
-
"utrecht-pagination",
|
|
96
|
-
"utrecht-pagination--distanced",
|
|
97
|
-
styles.pagination,
|
|
98
|
-
className,
|
|
99
|
-
)}
|
|
100
|
-
aria-label={t("components.pagination-landmark")}
|
|
101
|
-
>
|
|
102
|
-
{prev && (
|
|
103
|
-
<span className="utrecht-pagination__before">
|
|
104
|
-
<RelativeLink href={String(prev)} position="prev" />
|
|
105
|
-
</span>
|
|
106
|
-
)}
|
|
107
|
-
{/* biome-ignore-start lint/a11y/useSemanticElements: taken from NLDS example */}
|
|
108
|
-
<span
|
|
109
|
-
role="group"
|
|
110
|
-
aria-label={t("components.pages")}
|
|
111
|
-
className="utrecht-pagination__pages"
|
|
112
|
-
>
|
|
113
|
-
{/* biome-ignore-end lint/a11y/useSemanticElements: taken from NLDS example */}
|
|
114
|
-
{links &&
|
|
115
|
-
links.length > 0 &&
|
|
116
|
-
links.map(({ href, label, range }, index) => (
|
|
117
|
-
<PageLink
|
|
118
|
-
href={href}
|
|
119
|
-
label={label}
|
|
120
|
-
range={range}
|
|
121
|
-
index={index}
|
|
122
|
-
current={current}
|
|
123
|
-
key={label}
|
|
124
|
-
/>
|
|
125
|
-
))}
|
|
126
|
-
</span>
|
|
127
|
-
{next && (
|
|
128
|
-
<span className="utrecht-pagination__after">
|
|
129
|
-
<RelativeLink href={String(next)} position="next" />
|
|
130
|
-
</span>
|
|
131
|
-
)}
|
|
132
|
-
</nav>
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const TranslatedPagination = (props: PaginationProps) => {
|
|
137
|
-
return (
|
|
138
|
-
<I18nextProvider i18n={i18n}>
|
|
139
|
-
<Pagination {...props} />
|
|
140
|
-
</I18nextProvider>
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export default TranslatedPagination;
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import type { ElementType, HTMLAttributes, PropsWithChildren } from "react";
|
|
3
|
+
import { I18nextProvider, useTranslation } from "react-i18next";
|
|
4
|
+
import i18n from "../i18n";
|
|
5
|
+
import styles from "./styles.module.css";
|
|
6
|
+
|
|
7
|
+
interface PageLinkProps
|
|
8
|
+
extends Omit<
|
|
9
|
+
HTMLAttributes<HTMLAnchorElement> & HTMLAttributes<HTMLSpanElement>,
|
|
10
|
+
"onAbort"
|
|
11
|
+
> {
|
|
12
|
+
href: string;
|
|
13
|
+
label: number | string;
|
|
14
|
+
range?: [number, number];
|
|
15
|
+
index: number;
|
|
16
|
+
current: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface RelativeLinkProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
20
|
+
href: string;
|
|
21
|
+
position: "prev" | "next";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface PaginationProps extends HTMLAttributes<HTMLElement> {
|
|
25
|
+
links: Array<{
|
|
26
|
+
href: PageLinkProps["href"];
|
|
27
|
+
label: PageLinkProps["label"];
|
|
28
|
+
/** Range of shown items on this page; [begin, end] */
|
|
29
|
+
range?: PageLinkProps["range"];
|
|
30
|
+
}>;
|
|
31
|
+
current?: PageLinkProps["current"];
|
|
32
|
+
prev?: string | false;
|
|
33
|
+
next?: string | false;
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const PageLink = (props: PageLinkProps) => {
|
|
38
|
+
const { t } = useTranslation();
|
|
39
|
+
const { href, label, range, index, current, ...restProps } = props;
|
|
40
|
+
const isCurrent = index === current;
|
|
41
|
+
const element = !isCurrent ? "a" : "span";
|
|
42
|
+
const hrefAttr = !isCurrent && { href };
|
|
43
|
+
const count =
|
|
44
|
+
(range && (range[0] === range[1] ? 1 : range[1] - range[0])) || 0;
|
|
45
|
+
|
|
46
|
+
const Element = element as ElementType<
|
|
47
|
+
HTMLAttributes<HTMLAnchorElement | HTMLSpanElement>
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Element
|
|
52
|
+
className={clsx(
|
|
53
|
+
"utrecht-pagination__page-link",
|
|
54
|
+
isCurrent && "utrecht-pagination__page-link--current",
|
|
55
|
+
)}
|
|
56
|
+
{...hrefAttr}
|
|
57
|
+
aria-current={isCurrent}
|
|
58
|
+
aria-label={
|
|
59
|
+
range && t(`components.page-and-results-range`, { label, range, count })
|
|
60
|
+
}
|
|
61
|
+
title={range && t(`components.results-range`, { range, count })}
|
|
62
|
+
{...restProps}
|
|
63
|
+
>
|
|
64
|
+
{label}
|
|
65
|
+
</Element>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const RelativeLink = (props: RelativeLinkProps) => {
|
|
70
|
+
const { t } = useTranslation();
|
|
71
|
+
const { href, position } = props;
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<a
|
|
75
|
+
href={href}
|
|
76
|
+
className={clsx(
|
|
77
|
+
"utrecht-pagination__relative-link",
|
|
78
|
+
"utrecht-pagination__relative-link--disabled",
|
|
79
|
+
`utrecht-pagination__relative-link--${position}`,
|
|
80
|
+
)}
|
|
81
|
+
rel={position}
|
|
82
|
+
>
|
|
83
|
+
{t(`components.${position}`)}
|
|
84
|
+
</a>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const Pagination = (props: PropsWithChildren<PaginationProps>) => {
|
|
89
|
+
const { t } = useTranslation();
|
|
90
|
+
const { links, current = 0, prev, next, className } = props;
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<nav
|
|
94
|
+
className={clsx(
|
|
95
|
+
"utrecht-pagination",
|
|
96
|
+
"utrecht-pagination--distanced",
|
|
97
|
+
styles.pagination,
|
|
98
|
+
className,
|
|
99
|
+
)}
|
|
100
|
+
aria-label={t("components.pagination-landmark")}
|
|
101
|
+
>
|
|
102
|
+
{prev && (
|
|
103
|
+
<span className="utrecht-pagination__before">
|
|
104
|
+
<RelativeLink href={String(prev)} position="prev" />
|
|
105
|
+
</span>
|
|
106
|
+
)}
|
|
107
|
+
{/* biome-ignore-start lint/a11y/useSemanticElements: taken from NLDS example */}
|
|
108
|
+
<span
|
|
109
|
+
role="group"
|
|
110
|
+
aria-label={t("components.pages")}
|
|
111
|
+
className="utrecht-pagination__pages"
|
|
112
|
+
>
|
|
113
|
+
{/* biome-ignore-end lint/a11y/useSemanticElements: taken from NLDS example */}
|
|
114
|
+
{links &&
|
|
115
|
+
links.length > 0 &&
|
|
116
|
+
links.map(({ href, label, range }, index) => (
|
|
117
|
+
<PageLink
|
|
118
|
+
href={href}
|
|
119
|
+
label={label}
|
|
120
|
+
range={range}
|
|
121
|
+
index={index}
|
|
122
|
+
current={current}
|
|
123
|
+
key={label}
|
|
124
|
+
/>
|
|
125
|
+
))}
|
|
126
|
+
</span>
|
|
127
|
+
{next && (
|
|
128
|
+
<span className="utrecht-pagination__after">
|
|
129
|
+
<RelativeLink href={String(next)} position="next" />
|
|
130
|
+
</span>
|
|
131
|
+
)}
|
|
132
|
+
</nav>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const TranslatedPagination = (props: PaginationProps) => {
|
|
137
|
+
return (
|
|
138
|
+
<I18nextProvider i18n={i18n}>
|
|
139
|
+
<Pagination {...props} />
|
|
140
|
+
</I18nextProvider>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export default TranslatedPagination;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
.pagination {
|
|
2
|
-
text-align: center;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
:global(
|
|
6
|
-
.utrecht-pagination__page-link.utrecht-pagination__page-link--current:hover
|
|
7
|
-
) {
|
|
8
|
-
color: var(--utrecht-pagination-page-link-current-color);
|
|
9
|
-
background-color: var(
|
|
10
|
-
--utrecht-pagination-page-link-current-background-color
|
|
11
|
-
);
|
|
12
|
-
border-color: var(--utrecht-pagination-page-link-current-border-color);
|
|
13
|
-
}
|
|
1
|
+
.pagination {
|
|
2
|
+
text-align: center;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:global(
|
|
6
|
+
.utrecht-pagination__page-link.utrecht-pagination__page-link--current:hover
|
|
7
|
+
) {
|
|
8
|
+
color: var(--utrecht-pagination-page-link-current-color);
|
|
9
|
+
background-color: var(
|
|
10
|
+
--utrecht-pagination-page-link-current-background-color
|
|
11
|
+
);
|
|
12
|
+
border-color: var(--utrecht-pagination-page-link-current-border-color);
|
|
13
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ParagraphProps,
|
|
3
|
-
Paragraph as RHCParagraph,
|
|
4
|
-
} from "@rijkshuisstijl-community/components-react";
|
|
5
|
-
|
|
6
|
-
const Paragraph = (props: ParagraphProps) => {
|
|
7
|
-
return <RHCParagraph {...props} />;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default Paragraph;
|
|
1
|
+
import {
|
|
2
|
+
type ParagraphProps,
|
|
3
|
+
Paragraph as RHCParagraph,
|
|
4
|
+
} from "@rijkshuisstijl-community/components-react";
|
|
5
|
+
|
|
6
|
+
const Paragraph = (props: ParagraphProps) => {
|
|
7
|
+
return <RHCParagraph {...props} />;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default Paragraph;
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
/* Temporary file to showcase PillBadge examples in e.g. Storybook later */
|
|
2
|
-
|
|
3
|
-
import Block from "../block/Block";
|
|
4
|
-
import PillBadge from "./PillBadge";
|
|
5
|
-
|
|
6
|
-
export const PillBadgeExamples = () => {
|
|
7
|
-
return (
|
|
8
|
-
<Block layout="flex-col">
|
|
9
|
-
<PillBadge
|
|
10
|
-
startValue="Kleur"
|
|
11
|
-
endValue="robijnrood"
|
|
12
|
-
type="color"
|
|
13
|
-
color="robijnrood"
|
|
14
|
-
/>
|
|
15
|
-
<PillBadge startValue="Kleur" endValue="roze" type="color" color="roze" />
|
|
16
|
-
<PillBadge startValue="Kleur" endValue="rood" type="color" color="rood" />
|
|
17
|
-
<PillBadge
|
|
18
|
-
startValue="Kleur"
|
|
19
|
-
endValue="oranje"
|
|
20
|
-
type="color"
|
|
21
|
-
color="oranje"
|
|
22
|
-
/>
|
|
23
|
-
<PillBadge
|
|
24
|
-
startValue="Kleur"
|
|
25
|
-
endValue="donkergeel"
|
|
26
|
-
type="color"
|
|
27
|
-
color="donkergeel"
|
|
28
|
-
/>
|
|
29
|
-
<PillBadge startValue="Kleur" endValue="geel" type="color" color="geel" />
|
|
30
|
-
<PillBadge
|
|
31
|
-
startValue="Kleur"
|
|
32
|
-
endValue="donkergroen"
|
|
33
|
-
type="color"
|
|
34
|
-
color="donkergroen"
|
|
35
|
-
/>
|
|
36
|
-
<PillBadge
|
|
37
|
-
startValue="Kleur"
|
|
38
|
-
endValue="groen"
|
|
39
|
-
type="color"
|
|
40
|
-
color="groen"
|
|
41
|
-
/>
|
|
42
|
-
<PillBadge
|
|
43
|
-
startValue="Kleur"
|
|
44
|
-
endValue="mosgroen"
|
|
45
|
-
type="color"
|
|
46
|
-
color="mosgroen"
|
|
47
|
-
/>
|
|
48
|
-
<PillBadge
|
|
49
|
-
startValue="Kleur"
|
|
50
|
-
endValue="mintgroen"
|
|
51
|
-
type="color"
|
|
52
|
-
color="mintgroen"
|
|
53
|
-
/>
|
|
54
|
-
<PillBadge
|
|
55
|
-
startValue="Kleur"
|
|
56
|
-
endValue="donkerblauw"
|
|
57
|
-
type="color"
|
|
58
|
-
color="donkerblauw"
|
|
59
|
-
/>
|
|
60
|
-
<PillBadge
|
|
61
|
-
startValue="Kleur"
|
|
62
|
-
endValue="hemelblauw"
|
|
63
|
-
type="color"
|
|
64
|
-
color="hemelblauw"
|
|
65
|
-
/>
|
|
66
|
-
<PillBadge
|
|
67
|
-
startValue="Kleur"
|
|
68
|
-
endValue="paars"
|
|
69
|
-
type="color"
|
|
70
|
-
color="paars"
|
|
71
|
-
/>
|
|
72
|
-
<PillBadge
|
|
73
|
-
startValue="Kleur"
|
|
74
|
-
endValue="violet"
|
|
75
|
-
type="color"
|
|
76
|
-
color="violet"
|
|
77
|
-
/>
|
|
78
|
-
<PillBadge
|
|
79
|
-
startValue="Kleur"
|
|
80
|
-
endValue="lichtblauw"
|
|
81
|
-
type="color"
|
|
82
|
-
color="lichtblauw"
|
|
83
|
-
/>
|
|
84
|
-
<PillBadge
|
|
85
|
-
startValue="Kleur"
|
|
86
|
-
endValue="coolgrey"
|
|
87
|
-
type="color"
|
|
88
|
-
color="coolgrey"
|
|
89
|
-
/>
|
|
90
|
-
<PillBadge startValue="Percentage" endValue="76" type="percentage" />
|
|
91
|
-
<PillBadge
|
|
92
|
-
startValue="Percentage & Kleur"
|
|
93
|
-
endValue="42"
|
|
94
|
-
type="percentage"
|
|
95
|
-
color="robijnrood"
|
|
96
|
-
/>
|
|
97
|
-
<PillBadge
|
|
98
|
-
startValue="Percentage & Kleur"
|
|
99
|
-
endValue="21"
|
|
100
|
-
type="percentage"
|
|
101
|
-
color="rood"
|
|
102
|
-
/>
|
|
103
|
-
</Block>
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export default PillBadgeExamples;
|
|
1
|
+
/* Temporary file to showcase PillBadge examples in e.g. Storybook later */
|
|
2
|
+
|
|
3
|
+
import Block from "../block/Block";
|
|
4
|
+
import PillBadge from "./PillBadge";
|
|
5
|
+
|
|
6
|
+
export const PillBadgeExamples = () => {
|
|
7
|
+
return (
|
|
8
|
+
<Block layout="flex-col">
|
|
9
|
+
<PillBadge
|
|
10
|
+
startValue="Kleur"
|
|
11
|
+
endValue="robijnrood"
|
|
12
|
+
type="color"
|
|
13
|
+
color="robijnrood"
|
|
14
|
+
/>
|
|
15
|
+
<PillBadge startValue="Kleur" endValue="roze" type="color" color="roze" />
|
|
16
|
+
<PillBadge startValue="Kleur" endValue="rood" type="color" color="rood" />
|
|
17
|
+
<PillBadge
|
|
18
|
+
startValue="Kleur"
|
|
19
|
+
endValue="oranje"
|
|
20
|
+
type="color"
|
|
21
|
+
color="oranje"
|
|
22
|
+
/>
|
|
23
|
+
<PillBadge
|
|
24
|
+
startValue="Kleur"
|
|
25
|
+
endValue="donkergeel"
|
|
26
|
+
type="color"
|
|
27
|
+
color="donkergeel"
|
|
28
|
+
/>
|
|
29
|
+
<PillBadge startValue="Kleur" endValue="geel" type="color" color="geel" />
|
|
30
|
+
<PillBadge
|
|
31
|
+
startValue="Kleur"
|
|
32
|
+
endValue="donkergroen"
|
|
33
|
+
type="color"
|
|
34
|
+
color="donkergroen"
|
|
35
|
+
/>
|
|
36
|
+
<PillBadge
|
|
37
|
+
startValue="Kleur"
|
|
38
|
+
endValue="groen"
|
|
39
|
+
type="color"
|
|
40
|
+
color="groen"
|
|
41
|
+
/>
|
|
42
|
+
<PillBadge
|
|
43
|
+
startValue="Kleur"
|
|
44
|
+
endValue="mosgroen"
|
|
45
|
+
type="color"
|
|
46
|
+
color="mosgroen"
|
|
47
|
+
/>
|
|
48
|
+
<PillBadge
|
|
49
|
+
startValue="Kleur"
|
|
50
|
+
endValue="mintgroen"
|
|
51
|
+
type="color"
|
|
52
|
+
color="mintgroen"
|
|
53
|
+
/>
|
|
54
|
+
<PillBadge
|
|
55
|
+
startValue="Kleur"
|
|
56
|
+
endValue="donkerblauw"
|
|
57
|
+
type="color"
|
|
58
|
+
color="donkerblauw"
|
|
59
|
+
/>
|
|
60
|
+
<PillBadge
|
|
61
|
+
startValue="Kleur"
|
|
62
|
+
endValue="hemelblauw"
|
|
63
|
+
type="color"
|
|
64
|
+
color="hemelblauw"
|
|
65
|
+
/>
|
|
66
|
+
<PillBadge
|
|
67
|
+
startValue="Kleur"
|
|
68
|
+
endValue="paars"
|
|
69
|
+
type="color"
|
|
70
|
+
color="paars"
|
|
71
|
+
/>
|
|
72
|
+
<PillBadge
|
|
73
|
+
startValue="Kleur"
|
|
74
|
+
endValue="violet"
|
|
75
|
+
type="color"
|
|
76
|
+
color="violet"
|
|
77
|
+
/>
|
|
78
|
+
<PillBadge
|
|
79
|
+
startValue="Kleur"
|
|
80
|
+
endValue="lichtblauw"
|
|
81
|
+
type="color"
|
|
82
|
+
color="lichtblauw"
|
|
83
|
+
/>
|
|
84
|
+
<PillBadge
|
|
85
|
+
startValue="Kleur"
|
|
86
|
+
endValue="coolgrey"
|
|
87
|
+
type="color"
|
|
88
|
+
color="coolgrey"
|
|
89
|
+
/>
|
|
90
|
+
<PillBadge startValue="Percentage" endValue="76" type="percentage" />
|
|
91
|
+
<PillBadge
|
|
92
|
+
startValue="Percentage & Kleur"
|
|
93
|
+
endValue="42"
|
|
94
|
+
type="percentage"
|
|
95
|
+
color="robijnrood"
|
|
96
|
+
/>
|
|
97
|
+
<PillBadge
|
|
98
|
+
startValue="Percentage & Kleur"
|
|
99
|
+
endValue="21"
|
|
100
|
+
type="percentage"
|
|
101
|
+
color="rood"
|
|
102
|
+
/>
|
|
103
|
+
</Block>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default PillBadgeExamples;
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import type { PropsWithChildren } from "react";
|
|
3
|
-
import styles from "./styles.module.css";
|
|
4
|
-
|
|
5
|
-
export interface PillBadgeProps {
|
|
6
|
-
className?: string;
|
|
7
|
-
startValue: string | number | null | undefined;
|
|
8
|
-
endValue: string | number | null | undefined;
|
|
9
|
-
caption?: string;
|
|
10
|
-
type?: "color" | "percentage";
|
|
11
|
-
color?: string; // todo: enum
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const PillBadge = (props: PropsWithChildren<PillBadgeProps>) => {
|
|
15
|
-
const {
|
|
16
|
-
className,
|
|
17
|
-
startValue,
|
|
18
|
-
endValue,
|
|
19
|
-
caption,
|
|
20
|
-
type = "color",
|
|
21
|
-
color,
|
|
22
|
-
children,
|
|
23
|
-
...restProps
|
|
24
|
-
} = props;
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<figure
|
|
28
|
-
className={clsx(styles["pill-badge-figure"], className)}
|
|
29
|
-
{...restProps}
|
|
30
|
-
>
|
|
31
|
-
<div
|
|
32
|
-
className={clsx(
|
|
33
|
-
styles["pill-badge"],
|
|
34
|
-
type === "percentage" && styles["pill-badge--type-percentage"],
|
|
35
|
-
)}
|
|
36
|
-
data-percentage={type === "percentage" ? endValue : undefined}
|
|
37
|
-
data-color={color}
|
|
38
|
-
>
|
|
39
|
-
<span className={styles["pill-badge__start"]}>{startValue || "■"}</span>
|
|
40
|
-
<span className={styles["pill-badge__end"]}>
|
|
41
|
-
{endValue || "-"}
|
|
42
|
-
{type === "percentage" ? "%" : ""}
|
|
43
|
-
</span>
|
|
44
|
-
</div>
|
|
45
|
-
{children}
|
|
46
|
-
{caption && <figcaption>{caption}</figcaption>}
|
|
47
|
-
</figure>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default PillBadge;
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
import styles from "./styles.module.css";
|
|
4
|
+
|
|
5
|
+
export interface PillBadgeProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
startValue: string | number | null | undefined;
|
|
8
|
+
endValue: string | number | null | undefined;
|
|
9
|
+
caption?: string;
|
|
10
|
+
type?: "color" | "percentage";
|
|
11
|
+
color?: string; // todo: enum
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const PillBadge = (props: PropsWithChildren<PillBadgeProps>) => {
|
|
15
|
+
const {
|
|
16
|
+
className,
|
|
17
|
+
startValue,
|
|
18
|
+
endValue,
|
|
19
|
+
caption,
|
|
20
|
+
type = "color",
|
|
21
|
+
color,
|
|
22
|
+
children,
|
|
23
|
+
...restProps
|
|
24
|
+
} = props;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<figure
|
|
28
|
+
className={clsx(styles["pill-badge-figure"], className)}
|
|
29
|
+
{...restProps}
|
|
30
|
+
>
|
|
31
|
+
<div
|
|
32
|
+
className={clsx(
|
|
33
|
+
styles["pill-badge"],
|
|
34
|
+
type === "percentage" && styles["pill-badge--type-percentage"],
|
|
35
|
+
)}
|
|
36
|
+
data-percentage={type === "percentage" ? endValue : undefined}
|
|
37
|
+
data-color={color}
|
|
38
|
+
>
|
|
39
|
+
<span className={styles["pill-badge__start"]}>{startValue || "■"}</span>
|
|
40
|
+
<span className={styles["pill-badge__end"]}>
|
|
41
|
+
{endValue || "-"}
|
|
42
|
+
{type === "percentage" ? "%" : ""}
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
{children}
|
|
46
|
+
{caption && <figcaption>{caption}</figcaption>}
|
|
47
|
+
</figure>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default PillBadge;
|