Skip to content

Commit 3e9b331

Browse files
committed
[#3604] adding indexes for storybook
1 parent e23dd0b commit 3e9b331

File tree

7 files changed

+27
-36
lines changed

7 files changed

+27
-36
lines changed
Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import React from 'react';
2-
import { Meta, StoryObj } from '@storybook/react';
3-
import './HomepagePluginSection';
1+
import '@open-inwoner/design-tokens/dist/css/index.css';
2+
import type { Meta, StoryObj } from '@storybook/preact';
3+
import { withLoader } from '@react/lib/decorators/storybook';
4+
import { HOMEPAGE_PLUGIN_SECTION_DEFINITION } from '.';
45

56
interface HomepagePluginSectionProps {
67
title?: string;
@@ -9,8 +10,11 @@ interface HomepagePluginSectionProps {
910
showIndicator?: boolean;
1011
}
1112

13+
type Story = StoryObj<HomepagePluginSectionProps>;
14+
1215
const meta: Meta<HomepagePluginSectionProps> = {
1316
title: 'WebComponents/HomepagePluginSection',
17+
decorators: [withLoader(HOMEPAGE_PLUGIN_SECTION_DEFINITION.tagName)],
1418
parameters: {
1519
layout: 'padded',
1620
docs: {
@@ -31,8 +35,6 @@ The homepage plugin section web component. This section typically consist of a s
3135

3236
export default meta;
3337

34-
type Story = StoryObj<HomepagePluginSectionProps>;
35-
3638
export const Default: Story = {
3739
args: {
3840
title: 'Mijn plugin sectie',
@@ -41,12 +43,7 @@ export const Default: Story = {
4143
showIndicator: false,
4244
},
4345
render: ({ title, nextUrl, nextUrlLabel, showIndicator }) =>
44-
React.createElement('oip-homepage-plugin-section', {
45-
title,
46-
'next-url': nextUrl,
47-
'next-url-label': nextUrlLabel,
48-
'show-indicator': showIndicator,
49-
}),
46+
`<oip-homepage-plugin-section title="${title}" next-url="${nextUrl}" next-url-label="${nextUrlLabel}" show-indicator="${showIndicator}"></oip-homepage-plugin-section>`,
5047
};
5148

5249
export const WithIndicator: Story = {
@@ -57,10 +54,5 @@ export const WithIndicator: Story = {
5754
showIndicator: true,
5855
},
5956
render: ({ title, nextUrl, nextUrlLabel, showIndicator }) =>
60-
React.createElement('oip-homepage-plugin-section', {
61-
title,
62-
'next-url': nextUrl,
63-
'next-url-label': nextUrlLabel,
64-
'show-indicator': showIndicator,
65-
}),
57+
`<oip-homepage-plugin-section title="${title}" next-url="${nextUrl}" next-url-label="${nextUrlLabel}" show-indicator="${showIndicator}"></oip-homepage-plugin-section>`,
6658
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { default as HomepagePluginSection } from './HomepagePluginSection';
2+
export { HOMEPAGE_PLUGIN_SECTION_DEFINITION } from './constants';
3+
export type { IHomepagePluginSectionProps } from './HomepagePluginSection';

src/open_inwoner/react/components/Spinner/Spinner.stories.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import React from 'react';
2-
import { Meta, StoryObj } from '@storybook/react';
1+
import type { Meta, StoryObj } from '@storybook/preact';
2+
import { withLoader } from '@react/lib/decorators/storybook';
3+
import { LOADING_SPINNER_DEFINITION } from '.';
34
import './Spinner';
45

56
interface SpinnerProps {
@@ -9,6 +10,7 @@ interface SpinnerProps {
910

1011
const meta: Meta<SpinnerProps> = {
1112
title: 'WebComponents/Spinner',
13+
decorators: [withLoader(LOADING_SPINNER_DEFINITION.tagName)],
1214
parameters: {
1315
layout: 'padded',
1416
docs: {
@@ -34,13 +36,4 @@ export const Default: Story = {
3436
loadingText: 'Zaken laden...',
3537
iconName: 'rotate_right',
3638
},
37-
render: ({ loadingText, iconName }) =>
38-
// NOTE: We are not using a React functional component (FC) here because:
39-
// 1. The web component has a hyphenated tag name (<oip-loading-spinner>), which is invalid JSX.
40-
// 2. Using FC would require a wrapper just to satisfy TypeScript/JSX.
41-
// 3. React.createElement allows to render the actual custom element directly.
42-
React.createElement('oip-loading-spinner', {
43-
'loading-text': loadingText,
44-
'icon-name': iconName,
45-
}),
4639
};

src/open_inwoner/react/components/Spinner/Spinner.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { AnyComponent as FC } from 'preact';
22
// import { usePropsOrScriptData } from '@react/lib/json/getJsonScriptData';
3-
// import './LoadingSpinner.scss';
43

54
export interface ILoadingSpinnerProps {
65
loadingText?: string;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { LOADING_SPINNER_DEFINITION } from './constants';
2+
export type { ILoadingSpinnerProps } from './Spinner';

src/open_inwoner/react/components/ZakenPluginZaakItem/ZakenPluginZaakItem.stories.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import React from 'react';
2-
import { Meta, StoryObj } from '@storybook/react';
1+
import '@open-inwoner/design-tokens/dist/css/index.css';
2+
import type { Meta, StoryObj } from '@storybook/preact';
3+
import { withLoader } from '@react/lib/decorators/storybook';
4+
import { ZAKEN_PLUGIN_ZAAK_ITEM_DEFINITION } from '.';
35
import './ZakenPluginZaakItem';
46

57
interface ZaakItemProps {
@@ -10,6 +12,7 @@ interface ZaakItemProps {
1012

1113
const meta: Meta<ZaakItemProps> = {
1214
title: 'WebComponents/ZakenPluginZaakItem',
15+
decorators: [withLoader(ZAKEN_PLUGIN_ZAAK_ITEM_DEFINITION.tagName)],
1316
parameters: {
1417
layout: 'padded',
1518
},
@@ -26,9 +29,5 @@ export const Default: Story = {
2629
detailUrl: '/mijn-aanvragen/1/abcdef/status/',
2730
},
2831
render: ({ description, identificatie, detailUrl }) =>
29-
React.createElement('oip-zaken-plugin-zaak-item', {
30-
description,
31-
identificatie,
32-
'detail-url': detailUrl,
33-
}),
32+
`<oip-zaken-plugin-zaak-item description="${description}" identificatie="${identificatie}" detail-url="${detailUrl}"></oip-zaken-plugin-zaak-item>`,
3433
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { default as HomepagePluginSection } from './ZakenPluginZaakItem';
2+
export { ZAKEN_PLUGIN_ZAAK_ITEM_DEFINITION } from './constants';
3+
export type { IZakenPluginZaakItemProps } from './ZakenPluginZaakItem';

0 commit comments

Comments
 (0)