Skip to content

Commit

Permalink
Merge pull request #182 from thoughtindustries/CLM-7570-convert-story…
Browse files Browse the repository at this point in the history
…book-to-storybook-3

Upgrade Story Component Format
  • Loading branch information
BReimerTI authored Mar 8, 2023
2 parents f77f9ec + 4b6d47d commit c2feac3
Show file tree
Hide file tree
Showing 33 changed files with 27,354 additions and 49,597 deletions.
16 changes: 16 additions & 0 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": 100
}
}
],
"@babel/preset-typescript",
"@babel/preset-react"
],
"plugins": []
}
26 changes: 21 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
"plugin:prettier/recommended",
"plugin:storybook/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand All @@ -20,12 +21,27 @@
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
"react/jsx-curly-brace-presence": ["error", { "props": "never" }],
"react/jsx-curly-brace-presence": [
"error",
{
"props": "never"
}
],
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-explicit-any": ["off"],
"@typescript-eslint/ban-ts-comment": ["error", {"ts-ignore":"allow-with-description"}]
"@typescript-eslint/no-explicit-any": [
"off"
],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": "allow-with-description"
}
]
},
"settings": {
"react": {
Expand Down
120 changes: 0 additions & 120 deletions .storybook/i18next.js

This file was deleted.

28 changes: 0 additions & 28 deletions .storybook/main.js

This file was deleted.

16 changes: 16 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { StorybookConfig } from '@storybook/types';
const config: StorybookConfig = {
stories: ['../packages/'],
staticDirs: ['./public'],
addons: [
'@storybook/addon-links',
'@storybook/addon-controls',
'storybook-addon-apollo-client',
'@storybook/addon-toolbars'
],
framework: '@storybook/react-vite',
docs: {
autodocs: true
}
};
export default config;
1 change: 1 addition & 0 deletions .storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link rel="favicon" href="/favicon.ico">
6 changes: 6 additions & 0 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { addons } from '@storybook/manager-api';
import theme from './theme';

addons.setConfig({
theme: theme
});
21 changes: 0 additions & 21 deletions .storybook/preview.js

This file was deleted.

55 changes: 55 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React, { Suspense, useEffect } from 'react';
import { I18nextProvider } from 'react-i18next';
import './style.css';
import { MockedProvider } from '@apollo/client/testing';
import { i18n } from '../i18n/i18n';
import { cookieDecorator } from 'storybook-addon-cookie';

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/
}
},
apolloClient: {
MockedProvider
},
i18n,
locale: 'en'
};

const withI18next = (Story, context) => {
const { locale } = context.globals;

useEffect(() => {
i18n.changeLanguage(locale);
}, [locale]);
return (
<Suspense fallback={<div>loading translations...</div>}>
<I18nextProvider i18n={i18n}>
<Story />
</I18nextProvider>
</Suspense>
);
};

export const globalTypes = {
locale: {
name: 'Locale',
description: 'Internationalization locale',
defaultValue: 'en',
toolbar: {
icon: 'globe',
items: [{ value: 'en', right: '🇺🇸', title: 'English' }]
}
},
['addon-apolloClient/queries']: {
name: 'Apollo client addon queries',
description: 'Apollo client addon queries',
defaultValue: []
}
};

export const decorators = [cookieDecorator, withI18next];
Binary file added .storybook/public/favicon.ico
Binary file not shown.
8 changes: 8 additions & 0 deletions .storybook/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { create } from '@storybook/theming';

export default create({
base: 'light',
brandTitle: 'Thought Industries',
brandUrl: 'https://developer.thoughtindustries.com/',
brandTarget: '_self'
});
Loading

0 comments on commit c2feac3

Please sign in to comment.