Skip to content

Commit e3ff85a

Browse files
RoanheidRobbert
authored andcommitted
small fix to run theme-switcher for windows environment, add rhc-alert to themes
1 parent ee3ad2b commit e3ff85a

7 files changed

Lines changed: 90 additions & 12 deletions

File tree

packages/components-react/design-tokens-table-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
"scripts": {
3333
"build": "rollup --config ./rollup.config.mjs",
34-
"clean": "rimraf ./dist/ ./*.tsbuildinfo ./.rollup.cache/",
34+
"clean": "rimraf ./dist/ ./tmp/ ./.rollup.cache/",
3535
"config": "tsc --showConfig",
3636
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
3737
"typecheck": "tsc"

packages/components-react/design-tokens-table-react/tsconfig.build.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"compilerOptions": {
44
"composite": false,
55
"declaration": true,
6-
"declarationMap": true
6+
"declarationMap": true,
7+
"incremental": true,
8+
"tsBuildInfoFile": "./tmp/tsconfig.dist.tsbuildinfo"
79
},
810
"include": ["src/*.ts", "src/*.tsx"],
911
"exclude": ["src/**/*.test.*"]
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import { readFile } from 'node:fs/promises';
2+
import { fileURLToPath } from 'node:url';
23
import merge from 'lodash-es/merge';
34

45
const tokenPackages = ['@utrecht/component-library-design-tokens/dist/tokens.json'];
56

67
export const getCommunityTokens = async () => {
78
const tokens = await Promise.all(
89
tokenPackages.map(async (tokensPath) => {
9-
const path = new URL(import.meta.resolve(tokensPath)).pathname;
10+
const url = import.meta.resolve(tokensPath);
11+
const path = fileURLToPath(url);
12+
1013
return JSON.parse(await readFile(path, 'utf-8'));
1114
}),
1215
);
16+
1317
return merge({}, ...tokens);
1418
};

packages/theme-switcher/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"directory": "packages/theme-switcher"
2323
},
2424
"scripts": {
25-
"build": "mkdir -p dist/ && node src/generate-json.mjs",
25+
"build": "mkdirp dist && node src/generate-json.mjs",
2626
"clean": "rimraf dist/"
2727
},
2828
"devDependencies": {
@@ -47,6 +47,7 @@
4747
"@nl-design-system-unstable/westervoort-design-tokens": "workspace:*",
4848
"@nl-design-system-unstable/zevenaar-design-tokens": "workspace:*",
4949
"@nl-design-system-unstable/zwolle-design-tokens": "workspace:*",
50+
"mkdirp": "3.0.1",
5051
"rimraf": "6.0.1"
5152
}
5253
}

packages/theme-toolkit/src/component-stories-rhc.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { STORY_GROUPS } from './component-stories-util';
2-
import { DotBadge, Logo } from '@rijkshuisstijl-community/components-react';
2+
import { DotBadge, Alert, Heading, Logo, Paragraph } from '@rijkshuisstijl-community/components-react';
33

44
export const RHC_COMPONENT_STORIES = [
55
{
@@ -16,4 +16,16 @@ export const RHC_COMPONENT_STORIES = [
1616
name: 'Rijkshuisstijl Logo',
1717
render: () => <Logo organisation="Rijkshuisstijl-community" />,
1818
},
19+
{
20+
storyId: 'react-rhc-alert--default',
21+
component: 'rhc-alert',
22+
group: STORY_GROUPS['ALERTS'],
23+
name: 'Rijkshuisstijl Alert',
24+
render: () => (
25+
<Alert type="info">
26+
<Heading level={3}>Heading</Heading>
27+
<Paragraph>Lorem ipsum dolor sit amet, consectetur ad isicing elit, sed do eiusmod</Paragraph>
28+
</Alert>
29+
),
30+
},
1931
];
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Alert, Heading, Paragraph } from '@rijkshuisstijl-community/components-react';
2+
import type { Meta, StoryObj } from '@storybook/react-vite';
3+
4+
const meta = {
5+
id: 'rhc-alert',
6+
title: 'Components/Alert/Rijkshuisstijl Community',
7+
component: Alert,
8+
parameters: { actions: { disable: true } },
9+
argTypes: {
10+
children: {
11+
description: 'HTML content of the alert',
12+
},
13+
type: {
14+
description: 'Type',
15+
control: { type: 'select' },
16+
options: ['', 'error', 'info', 'ok', 'warning'],
17+
},
18+
},
19+
args: {
20+
children: (
21+
<>
22+
<Heading level={2}>Lorem ipsum</Heading>
23+
<Paragraph>
24+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
25+
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
26+
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
27+
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
28+
est laborum.
29+
</Paragraph>
30+
</>
31+
),
32+
},
33+
} satisfies Meta<typeof Alert>;
34+
35+
type Story = StoryObj<typeof meta>;
36+
37+
export default meta;
38+
39+
// Een story met het voorbeeld thema
40+
export const VoorbeeldTheme: Story = {
41+
name: 'Voorbeeld theme',
42+
parameters: { theme: 'voorbeeld-theme' },
43+
};
44+
45+
// Een story met het thema van de organisatie die de component bijdraagt
46+
export const RijkshuisstijlTheme: Story = {
47+
name: 'Rijkshuisstijl Community theme',
48+
parameters: { theme: 'rhc-theme' },
49+
};

pnpm-lock.yaml

Lines changed: 17 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)