Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storybook 8 #185

Merged
merged 10 commits into from
Apr 16, 2024
3 changes: 0 additions & 3 deletions .babelrc.js

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
node-version:
- 20
- 18
- 16
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run check-format
- run: npm ci
- run: npm run typecheck
- run: npm test
- run: npm run check-format
File renamed without changes.
23 changes: 2 additions & 21 deletions .storybook/preview.js → .storybook/intl.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export const defaultLocales = ['en', 'de'];

// Provide your messages
const messages = {
export const messages = {
en: { message: 'Just some text.' },
de: { message: 'Nur etwas Text.' },
es: { message: 'Sólo un texto.' }
};

// Provide your formats (optional)
const formats = {
export const formats = {
en: {
date: {
custom: {
Expand All @@ -28,22 +28,3 @@ const formats = {
}
}
};

const getMessages = (locale) => messages[locale];
const getFormats = (locale) => formats[locale];

/**
* @type {import('@storybook/react').Preview}
*/
const preview = {
parameters: {
intl: {
locales: defaultLocales,
defaultLocale: 'en',
getMessages,
getFormats
}
}
};

export default preview;
4 changes: 2 additions & 2 deletions .storybook/local-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* to load the built addon in this test Storybook
*/
function previewAnnotations(entry = []) {
return [...entry, require.resolve('../dist/preview/index.js')];
return [...entry, require.resolve('../dist/preview.js')];
}

function managerEntries(entry = []) {
return [...entry, require.resolve('../dist/manager/index.js')];
return [...entry, require.resolve('../dist/manager.js')];
}

module.exports = {
Expand Down
8 changes: 0 additions & 8 deletions .storybook/main.js

This file was deleted.

15 changes: 15 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['../src/stories/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['storybook-addon-intl'],
framework: {
name: '@storybook/react-vite',
options: {}
},
docs: {
autodocs: 'tag'
}
};

export default config;
4 changes: 4 additions & 0 deletions .storybook/preview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
html,
body {
font-family: sans-serif;
}
20 changes: 20 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defaultLocales, formats, messages } from './intl';
import { Preview } from '@storybook/react';

import './preview.css';

const getMessages = (locale) => messages[locale];
const getFormats = (locale) => formats[locale];

const preview: Preview = {
parameters: {
intl: {
locales: defaultLocales,
defaultLocale: 'en',
getMessages,
getFormats
}
}
};

export default preview;
48 changes: 0 additions & 48 deletions .storybook/stories/01-Message.stories.js

This file was deleted.

12 changes: 0 additions & 12 deletions .storybook/stories/02-Date.stories.js

This file was deleted.

7 changes: 5 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module.exports = {
roots: ['<rootDir>/src']
export default {
roots: ['<rootDir>/src'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest'
}
};
2 changes: 1 addition & 1 deletion manager.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/manager');
import './dist/manager';
Loading
Loading