Skip to content

Commit d0bb07e

Browse files
committed
✨ [REFACTORING] implement preact webcomponent
1 parent 9ac56d8 commit d0bb07e

File tree

129 files changed

+4707
-27310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+4707
-27310
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- uses: actions/checkout@v3
2222
- uses: actions/setup-node@v3
2323
with:
24-
node-version: 18
24+
node-version-file: '.nvmrc'
2525
- run: npm ci
2626
- run: npm run test:ci
2727
- run: npm run type-check
@@ -288,7 +288,7 @@ jobs:
288288
- uses: actions/checkout@v3
289289
- uses: actions/setup-node@v3
290290
with:
291-
node-version: '18'
291+
node-version-file: '.nvmrc'
292292
- run: npm ci
293293

294294
# Build frontend assets first to generate CSS bundle

.storybook/main.ts

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,14 @@
1-
import { StorybookConfig } from '@storybook/react-vite';
2-
import path from 'path';
1+
import type { StorybookConfig } from '@storybook/preact-vite';
32
import { mergeConfig } from 'vite';
43

54
const config: StorybookConfig = {
6-
framework: {
7-
name: '@storybook/react-vite',
8-
options: {},
9-
},
10-
core: {
11-
disableWhatsNewNotifications: true,
12-
},
13-
stories: [
14-
'../src/**/*.stories.@(js|jsx|ts|tsx|mdx)',
15-
'../src/open_inwoner/react/components/**/*.stories.@(js|jsx|ts|tsx)',
16-
],
5+
framework: { name: '@storybook/preact-vite', options: {} },
6+
core: { disableWhatsNewNotifications: true },
7+
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
178
addons: ['@storybook/addon-essentials', '@chromatic-com/storybook'],
18-
docs: {
19-
autodocs: true,
20-
},
21-
// staticDirs: ['../src/open_inwoner/static'], // For OIP icon fonts
22-
9+
docs: { autodocs: true },
2310
viteFinal: async (config) => {
2411
return mergeConfig(config, {
25-
resolve: {
26-
alias: {
27-
'@react': path.resolve(__dirname, '../src/open_inwoner/react'),
28-
'@webcomponents': path.resolve(
29-
__dirname,
30-
'../src/open_inwoner/webcomponents'
31-
),
32-
},
33-
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.mdx'],
34-
},
3512
css: {
3613
preprocessorOptions: {
3714
scss: {
@@ -42,20 +19,11 @@ const config: StorybookConfig = {
4219
},
4320
},
4421
},
45-
build: {
46-
target: 'esnext',
47-
},
22+
build: { target: 'esnext' },
4823
// Ensure esbuild doesn't add refresh runtime
49-
esbuild: {
50-
jsx: 'automatic',
51-
},
24+
esbuild: { jsx: 'automatic' },
5225
});
5326
},
54-
55-
typescript: {
56-
check: false, // Disable TypeScript checking to avoid conflicts
57-
reactDocgen: 'react-docgen-typescript',
58-
},
5927
};
6028

6129
export default config;

.storybook/preview.tsx

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,19 @@
1-
import type { Preview } from '@storybook/react';
2-
import type { StoryFn } from '@storybook/react';
3-
4-
// NLDS keys
5-
// @ts-expect-error - CSS imports handled by bundler
61
import '@open-inwoner/design-tokens/dist/css/index.css';
7-
// NLDS values
8-
// @ts-expect-error
2+
import { Preview } from '@storybook/preact';
3+
import {
4+
withIntl,
5+
withThemeClass,
6+
} from '../src/open_inwoner/react/lib/decorators';
97
import '../src/open_inwoner/static/bundles/open_inwoner-css.css';
108

11-
const withThemeClass = (Story: StoryFn) => {
12-
document.body.classList.add('openinwoner-theme');
13-
14-
return <Story />;
15-
};
16-
179
const preview: Preview = {
18-
decorators: [withThemeClass],
10+
decorators: [withThemeClass, withIntl],
1911
parameters: {
20-
controls: {
21-
matchers: {
22-
color: /(background|color)$/i,
23-
date: /Date$/,
24-
},
25-
},
12+
controls: { matchers: { color: /(background|color)$/i, date: /Date$/ } },
2613
options: {
2714
storySort: {
2815
method: 'alphabetical',
29-
order: ['Introduction', 'Developers', 'React'],
16+
order: ['Introduction', 'Developers', 'Preact'],
3017
},
3118
},
3219
layout: 'centered',

0 commit comments

Comments
 (0)