Skip to content

Commit 1e3440d

Browse files
authored
Merge branch 'main' into fix-csv-export
2 parents f885b0c + 8fe2fb4 commit 1e3440d

Some content is hidden

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

50 files changed

+8180
-7463
lines changed

.github/workflows/github-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
node: [14, 16, 'lts/*']
17+
node: [18, 20, 'lts/*']
1818

1919
steps:
2020
- uses: actions/checkout@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# next.js
1212
/.next/
1313
/out/
14+
next-env.d.ts
1415

1516
# production
1617
/build

.prettierrc.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Prettier configuration. Please avoid changing the current configuration.
2+
// But if you do so, please run the `npm run pretty` command.
3+
/** @type {import("prettier").Options} */
4+
const config = {
5+
endOfLine: 'lf',
6+
semi: true,
7+
singleQuote: true,
8+
tabWidth: 2,
9+
trailingComma: 'es5',
10+
arrowParens: 'always',
11+
importOrder: ['^react$', '^(?!^react$|^@/|^[./]).*', '^@/(.*)$', '^[./]'],
12+
importOrderSeparation: true,
13+
importOrderSortSpecifiers: true,
14+
importOrderParserPlugins: ['jsx', 'typescript'],
15+
plugins: ['@trivago/prettier-plugin-sort-imports'],
16+
};
17+
18+
module.exports = config;

.prettierrc.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

.storybook/main.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

.storybook/main.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { StorybookConfig } from '@storybook/nextjs';
2+
3+
const config: StorybookConfig = {
4+
framework: {
5+
name: '@storybook/nextjs',
6+
options: {},
7+
},
8+
9+
stories: ['../src/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
10+
11+
addons: [
12+
'@storybook/addon-links',
13+
'@storybook/addon-essentials',
14+
'storybook-dark-mode',
15+
],
16+
17+
staticDirs: ['../public'],
18+
19+
docs: {},
20+
21+
typescript: {
22+
reactDocgen: 'react-docgen-typescript',
23+
},
24+
};
25+
26+
export default config;

.storybook/preview.js

Lines changed: 0 additions & 104 deletions
This file was deleted.

.storybook/preview.tsx

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import React, { useEffect } from 'react';
2+
3+
import { Box, useColorMode } from '@chakra-ui/react';
4+
import { Preview } from '@storybook/react';
5+
import { themes } from '@storybook/theming';
6+
import { useTranslation } from 'react-i18next';
7+
import { useDarkMode } from 'storybook-dark-mode';
8+
9+
import { Providers } from '../src/Providers';
10+
import i18nGlobal from '../src/lib/i18n/client';
11+
import {
12+
AVAILABLE_LANGUAGES,
13+
DEFAULT_LANGUAGE_KEY,
14+
} from '../src/lib/i18n/constants';
15+
// @ts-ignore don't want to implement a d.ts declaration for storybook only
16+
import logoReversed from './logo-reversed.svg';
17+
// @ts-ignore don't want to implement a d.ts declaration for storybook only
18+
import logo from './logo.svg';
19+
20+
const DocumentationWrapper = ({ children, context, isDarkMode }) => {
21+
const { i18n } = useTranslation();
22+
const { colorMode, setColorMode } = useColorMode();
23+
24+
// Update color mode
25+
useEffect(() => {
26+
// Add timeout to prevent unsync color mode between docs and classic modes
27+
const timer = setTimeout(() => {
28+
if (isDarkMode) {
29+
setColorMode('dark');
30+
} else {
31+
setColorMode('light');
32+
}
33+
});
34+
return () => clearTimeout(timer);
35+
}, [isDarkMode]);
36+
37+
// Update language
38+
useEffect(() => {
39+
i18n.changeLanguage(context.globals.locale);
40+
}, [context.globals.locale]);
41+
42+
return (
43+
<Box
44+
id="start-ui-storybook-wrapper"
45+
p="4"
46+
pb="8"
47+
bg={colorMode === 'dark' ? 'gray.900' : 'white'}
48+
flex="1"
49+
>
50+
{children}
51+
</Box>
52+
);
53+
};
54+
55+
const preview: Preview = {
56+
tags: ['autodocs'],
57+
globalTypes: {
58+
locale: {
59+
name: 'Locale',
60+
description: 'Internationalization locale',
61+
defaultValue: DEFAULT_LANGUAGE_KEY,
62+
toolbar: {
63+
icon: 'globe',
64+
items: AVAILABLE_LANGUAGES.map(({ key }) => ({
65+
value: key,
66+
title: i18nGlobal.t(`languages.${String(key)}`),
67+
})),
68+
},
69+
},
70+
},
71+
parameters: {
72+
options: {
73+
storySort: {
74+
order: ['StyleGuide', 'Components', 'Fields', 'App Layout'],
75+
},
76+
},
77+
darkMode: {
78+
dark: themes.dark,
79+
light: themes.light,
80+
},
81+
layout: 'fullscreen',
82+
backgrounds: { disable: true, grid: { disable: true } },
83+
},
84+
decorators: [
85+
(story, context) => {
86+
const isDarkMode = useDarkMode();
87+
return (
88+
<Providers>
89+
<DocumentationWrapper isDarkMode={isDarkMode} context={context}>
90+
{/* Calling as a function to avoid errors. Learn more at:
91+
* https://github.com/storybookjs/storybook/issues/15223#issuecomment-1092837912
92+
*/}
93+
{story(context)}
94+
</DocumentationWrapper>
95+
</Providers>
96+
);
97+
},
98+
],
99+
};
100+
101+
export default preview;

next-env.d.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)