Skip to content

Commit

Permalink
Merge branch 'develop' into refactor/overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
lindapaiste authored Jul 26, 2023
2 parents 6582362 + 59326e8 commit 00b813b
Show file tree
Hide file tree
Showing 41 changed files with 41,177 additions and 25,489 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["airbnb", "prettier"],
"extends": ["airbnb", "prettier", "plugin:storybook/recommended"],
"parser": "@babel/eslint-parser",
"env": {
"browser": true,
Expand All @@ -20,6 +20,7 @@
"no-console": 0,
"no-alert": 0,
"no-underscore-dangle": 0,
"no-useless-catch": 2,
"max-len": [1, 120, 2, {"ignoreComments": true, "ignoreTemplateLiterals": true}],
"quote-props": [1, "as-needed"],
"no-unused-vars": [1, {"vars": "local", "args": "none"}],
Expand Down
44 changes: 25 additions & 19 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
const path = require('path');

module.exports = {
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
const config = {
stories: ['../client/**/*.stories.(jsx|mdx)'],
addons: [
'@storybook/addon-actions',
'@storybook/addon-docs',
'@storybook/addon-knobs',
'@storybook/addon-links',
'storybook-addon-theme-playground/dist/register'
'@storybook/addon-essentials',
'@storybook/addon-interactions'
],
webpackFinal: async config => {
// do mutation to the config

const rules = config.module.rules;

// modify storybook's file-loader rule to avoid conflicts with svgr
const fileLoaderRule = rules.find(rule => rule.test.test('.svg'));
fileLoaderRule.exclude = path.resolve(__dirname, '../client');
framework: {
name: '@storybook/react-webpack5',
options: {}
},
docs: {
autodocs: 'tag'
},
async webpackFinal(config) {
// https://storybook.js.org/docs/react/builders/webpack
// this modifies the existing image rule to exclude .svg files
// since we want to handle those files with @svgr/webpack
const imageRule = config.module.rules.find(rule => rule.test.test('.svg'))
imageRule.exclude = /\.svg$/

// use svgr for svg files
rules.push({
// configure .svg files to be loaded with @svgr/webpack
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
use: ['@svgr/webpack']
})

return config;
return config
},
};

export default config;


41 changes: 16 additions & 25 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
import React from 'react';
import { addDecorator, addParameters } from '@storybook/react';
import { withKnobs } from "@storybook/addon-knobs";
import { withThemePlayground } from 'storybook-addon-theme-playground';
import { ThemeProvider } from "styled-components";
import { Provider } from 'react-redux';

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

addDecorator(withKnobs);
const initialState = window.__INITIAL_STATE__;

const themeConfigs = Object.values(Theme).map(
name => {
return { name, theme: theme[name] };
}
);
const store = configureStore(initialState);

addDecorator(withThemePlayground({
theme: themeConfigs,
provider: ThemeProvider
}));
export const decorators = [
(Story) => (
<Provider store={store}>
<ThemeProvider>
<Story />
</ThemeProvider>
</Provider>
),
]

addParameters({
options: {
/**
* display the top-level grouping as a "root" in the sidebar
*/
showRoots: true,
},
})

// addDecorator(storyFn => <ThemeProvider theme={theme}>{storyFn()}</ThemeProvider>);
18 changes: 9 additions & 9 deletions client/common/Button.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { boolean, text } from '@storybook/addon-knobs';

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

export default {
title: 'Common/Button',
component: Button
component: Button,
args: {
children: 'this is the button',
label: 'submit',
disabled: false
}
};

export const AllFeatures = () => (
<Button
disabled={boolean('disabled', false)}
type="submit"
label={text('label', 'submit')}
>
{text('children', 'this is the button')}
export const AllFeatures = (args) => (
<Button disabled={args.disabled} type="submit" label={args.label}>
{args.children}
</Button>
);

Expand Down
16 changes: 10 additions & 6 deletions client/common/icons.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import React from 'react';
import { select } from '@storybook/addon-knobs';

import * as icons from './icons';

export default {
title: 'Common/Icons',
component: icons
component: icons,
argTypes: {
variant: {
options: Object.keys(icons),
control: { type: 'select' },
default: icons.CircleFolderIcon
}
}
};

export const AllIcons = () => {
const names = Object.keys(icons);

const SelectedIcon = icons[select('name', names, names[0])];
export const Icons = (args) => {
const SelectedIcon = icons[args.variant || 'CircleInfoIcon'];
return <SelectedIcon />;
};
6 changes: 1 addition & 5 deletions client/images/down-arrow-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions client/images/down-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 3 additions & 7 deletions client/images/down-filled-triangle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 2 additions & 8 deletions client/images/exit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions client/images/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions client/images/folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 2 additions & 8 deletions client/images/minus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions client/images/p5js-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 4 additions & 18 deletions client/images/play.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions client/images/plus-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 2 additions & 8 deletions client/images/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 1 addition & 14 deletions client/images/preferences.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions client/images/right-arrow-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 00b813b

Please sign in to comment.