-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/develop' into fix/hot-reload
# Conflicts: # package-lock.json # package.json
- Loading branch information
Showing
56 changed files
with
40,605 additions
and
24,501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { createBrowserHistory } from 'history'; | ||
|
||
const browserHistory = createBrowserHistory(); | ||
|
||
export default browserHistory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.