Skip to content

Commit 1a86c4c

Browse files
authored
Merge branch 'develop' into refactor/app
2 parents 5618c28 + 59326e8 commit 1a86c4c

Some content is hidden

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

41 files changed

+41177
-25489
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": ["airbnb", "prettier"],
2+
"extends": ["airbnb", "prettier", "plugin:storybook/recommended"],
33
"parser": "@babel/eslint-parser",
44
"env": {
55
"browser": true,
@@ -20,6 +20,7 @@
2020
"no-console": 0,
2121
"no-alert": 0,
2222
"no-underscore-dangle": 0,
23+
"no-useless-catch": 2,
2324
"max-len": [1, 120, 2, {"ignoreComments": true, "ignoreTemplateLiterals": true}],
2425
"quote-props": [1, "as-needed"],
2526
"no-unused-vars": [1, {"vars": "local", "args": "none"}],

.storybook/main.js

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
1-
const path = require('path');
2-
3-
module.exports = {
1+
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
2+
const config = {
43
stories: ['../client/**/*.stories.(jsx|mdx)'],
54
addons: [
6-
'@storybook/addon-actions',
7-
'@storybook/addon-docs',
8-
'@storybook/addon-knobs',
95
'@storybook/addon-links',
10-
'storybook-addon-theme-playground/dist/register'
6+
'@storybook/addon-essentials',
7+
'@storybook/addon-interactions'
118
],
12-
webpackFinal: async config => {
13-
// do mutation to the config
14-
15-
const rules = config.module.rules;
16-
17-
// modify storybook's file-loader rule to avoid conflicts with svgr
18-
const fileLoaderRule = rules.find(rule => rule.test.test('.svg'));
19-
fileLoaderRule.exclude = path.resolve(__dirname, '../client');
9+
framework: {
10+
name: '@storybook/react-webpack5',
11+
options: {}
12+
},
13+
docs: {
14+
autodocs: 'tag'
15+
},
16+
async webpackFinal(config) {
17+
// https://storybook.js.org/docs/react/builders/webpack
18+
// this modifies the existing image rule to exclude .svg files
19+
// since we want to handle those files with @svgr/webpack
20+
const imageRule = config.module.rules.find(rule => rule.test.test('.svg'))
21+
imageRule.exclude = /\.svg$/
2022

21-
// use svgr for svg files
22-
rules.push({
23+
// configure .svg files to be loaded with @svgr/webpack
24+
config.module.rules.push({
2325
test: /\.svg$/,
24-
use: ["@svgr/webpack"],
26+
use: ['@svgr/webpack']
2527
})
2628

27-
return config;
29+
return config
2830
},
2931
};
32+
33+
export default config;
34+
35+

.storybook/preview.js

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
import React from 'react';
2-
import { addDecorator, addParameters } from '@storybook/react';
3-
import { withKnobs } from "@storybook/addon-knobs";
4-
import { withThemePlayground } from 'storybook-addon-theme-playground';
5-
import { ThemeProvider } from "styled-components";
2+
import { Provider } from 'react-redux';
63

7-
import theme, { Theme } from '../client/theme';
4+
import ThemeProvider from '../client/modules/App/components/ThemeProvider';
5+
import configureStore from '../client/store';
6+
import '../client/i18n-test';
7+
import '../client/styles/build/css/main.css'
88

9-
addDecorator(withKnobs);
9+
const initialState = window.__INITIAL_STATE__;
1010

11-
const themeConfigs = Object.values(Theme).map(
12-
name => {
13-
return { name, theme: theme[name] };
14-
}
15-
);
11+
const store = configureStore(initialState);
1612

17-
addDecorator(withThemePlayground({
18-
theme: themeConfigs,
19-
provider: ThemeProvider
20-
}));
13+
export const decorators = [
14+
(Story) => (
15+
<Provider store={store}>
16+
<ThemeProvider>
17+
<Story />
18+
</ThemeProvider>
19+
</Provider>
20+
),
21+
]
2122

22-
addParameters({
23-
options: {
24-
/**
25-
* display the top-level grouping as a "root" in the sidebar
26-
*/
27-
showRoots: true,
28-
},
29-
})
30-
31-
// addDecorator(storyFn => <ThemeProvider theme={theme}>{storyFn()}</ThemeProvider>);

client/common/Button.stories.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import React from 'react';
22
import { action } from '@storybook/addon-actions';
3-
import { boolean, text } from '@storybook/addon-knobs';
43

54
import Button from './Button';
65
import { GithubIcon, DropdownArrowIcon, PlusIcon } from './icons';
76

87
export default {
98
title: 'Common/Button',
10-
component: Button
9+
component: Button,
10+
args: {
11+
children: 'this is the button',
12+
label: 'submit',
13+
disabled: false
14+
}
1115
};
1216

13-
export const AllFeatures = () => (
14-
<Button
15-
disabled={boolean('disabled', false)}
16-
type="submit"
17-
label={text('label', 'submit')}
18-
>
19-
{text('children', 'this is the button')}
17+
export const AllFeatures = (args) => (
18+
<Button disabled={args.disabled} type="submit" label={args.label}>
19+
{args.children}
2020
</Button>
2121
);
2222

client/common/icons.stories.jsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import React from 'react';
2-
import { select } from '@storybook/addon-knobs';
32

43
import * as icons from './icons';
54

65
export default {
76
title: 'Common/Icons',
8-
component: icons
7+
component: icons,
8+
argTypes: {
9+
variant: {
10+
options: Object.keys(icons),
11+
control: { type: 'select' },
12+
default: icons.CircleFolderIcon
13+
}
14+
}
915
};
1016

11-
export const AllIcons = () => {
12-
const names = Object.keys(icons);
13-
14-
const SelectedIcon = icons[select('name', names, names[0])];
17+
export const Icons = (args) => {
18+
const SelectedIcon = icons[args.variant || 'CircleInfoIcon'];
1519
return <SelectedIcon />;
1620
};

client/images/down-arrow-white.svg

Lines changed: 1 addition & 5 deletions
Loading

client/images/down-arrow.svg

Lines changed: 0 additions & 3 deletions
Loading
Lines changed: 3 additions & 7 deletions
Loading

client/images/exit.svg

Lines changed: 2 additions & 8 deletions
Loading

client/images/file.svg

Lines changed: 1 addition & 5 deletions
Loading

client/images/folder.svg

Lines changed: 1 addition & 5 deletions
Loading

client/images/minus.svg

Lines changed: 2 additions & 8 deletions
Loading

client/images/p5js-logo.svg

Lines changed: 0 additions & 4 deletions
Loading

client/images/play.svg

Lines changed: 4 additions & 18 deletions
Loading

client/images/plus-icon.svg

Lines changed: 1 addition & 5 deletions
Loading

client/images/plus.svg

Lines changed: 2 additions & 8 deletions
Loading

client/images/preferences.svg

Lines changed: 1 addition & 14 deletions
Loading

client/images/right-arrow-white.svg

Lines changed: 1 addition & 5 deletions
Loading

0 commit comments

Comments
 (0)