Skip to content

Commit 6ef0c0c

Browse files
MichaelDeBoeySaraVieira
authored andcommitted
Cleanup Storybook (codesandbox#2278)
1 parent c81cdc9 commit 6ef0c0c

File tree

10 files changed

+62
-46
lines changed

10 files changed

+62
-46
lines changed

packages/common/.storybook/addons.js

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import '@storybook/addon-actions/register';
2+
import '@storybook/addon-knobs/register';

packages/common/.storybook/config.js

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { withKnobs } from '@storybook/addon-knobs';
2+
import { addDecorator, addParameters, configure } from '@storybook/react';
3+
import { themes } from '@storybook/theming';
4+
5+
import { ThemeDecorator, withGlobal } from '../src/stories/decorators';
6+
7+
addDecorator(withKnobs);
8+
addDecorator(withGlobal);
9+
addDecorator(ThemeDecorator);
10+
11+
// Option defaults.
12+
addParameters({
13+
options: {
14+
theme: themes.dark,
15+
},
16+
});
17+
18+
// automatically import all files ending in *.stories.tsx
19+
const req = require.context('../src', true, /.stories.tsx$/);
20+
21+
const loadStories = () => {
22+
req.keys().forEach(req);
23+
};
24+
25+
configure(loadStories, module);

packages/common/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@types/lodash": "^4.14.123",
5858
"@types/react": "^16.8.12",
5959
"@types/react-icons": "^2.2.7",
60+
"@types/storybook__addon-actions": "^3.4.3",
6061
"@types/storybook__addon-knobs": "^5.0.3",
6162
"@types/storybook__react": "^4.0.2",
6263
"@types/styled-components": "^4.1.13",

packages/common/src/stories/decorators.tsx renamed to packages/common/src/stories/decorators/ThemeDecorator.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import * as React from 'react';
1+
import React from 'react';
22
import { ThemeProvider } from 'styled-components';
3-
import theme from '../theme';
3+
4+
import theme from '../../theme';
45

56
export const ThemeDecorator = (fn: () => JSX.Element) => (
67
<ThemeProvider theme={theme}>{fn()}</ThemeProvider>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './ThemeDecorator';
2+
export * from './withGlobal';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React, { Fragment } from 'react';
2+
import { createGlobalStyle } from 'styled-components';
3+
4+
import global from '../../global.css';
5+
6+
const GlobalStyle = createGlobalStyle`
7+
${global}
8+
`;
9+
10+
export const withGlobal = cb => (
11+
<Fragment>
12+
<GlobalStyle />
13+
14+
{cb()}
15+
</Fragment>
16+
);

standalone-packages/vscode-textmate/package-lock.json

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4456,6 +4456,11 @@
44564456
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
44574457
integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==
44584458

4459+
"@types/storybook__addon-actions@^3.4.3":
4460+
version "3.4.3"
4461+
resolved "https://registry.yarnpkg.com/@types/storybook__addon-actions/-/storybook__addon-actions-3.4.3.tgz#bb0c3fd066e1f495d3f2b724487e2b99194b3f1a"
4462+
integrity sha512-RSFFfruUHL7La4CZpuiKZ0mZvr5orjenFA2jc31tfPwvA3fYNH4/9XSfA2MB08IpJbF3aErtYWT5Dtigkxnltg==
4463+
44594464
"@types/storybook__addon-knobs@^5.0.3":
44604465
version "5.0.3"
44614466
resolved "https://registry.yarnpkg.com/@types/storybook__addon-knobs/-/storybook__addon-knobs-5.0.3.tgz#a6366877d7b21f9fa2cc9eb23650304388393350"

0 commit comments

Comments
 (0)