Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Getting fancier with Storybook #10647

Merged
merged 10 commits into from
Aug 21, 2020
6 changes: 6 additions & 0 deletions superset-frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ module.exports = {
},
},
},
{
files: ['*.stories.jsx','*.stories.tsx'],
rules: {
'import/no-extraneous-dependencies': 0,
}
},
],
rules: {
camelcase: [
Expand Down
5 changes: 3 additions & 2 deletions superset-frontend/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ const path = require('path');
const customConfig = require('../webpack.config.js');

module.exports = {
stories: ['../src/components/**/*.stories.(t|j)sx'],
stories: ['../src/components/**/*.stories.@(t|j)sx'],
addons: [
'@storybook/addon-actions',
'@storybook/addon-essentials',
'@storybook/addon-links',
'@storybook/preset-typescript',
'storybook-addon-jsx',
'@storybook/addon-knobs/register',
'storybook-addon-paddings',
],
webpackFinal: config => ({
...config,
Expand Down
13 changes: 13 additions & 0 deletions superset-frontend/.storybook/preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,27 @@
import React from 'react';
import { addDecorator } from '@storybook/react';
import { jsxDecorator } from 'storybook-addon-jsx';
import { addParameters } from '@storybook/react';
import { withPaddings } from 'storybook-addon-paddings';

import { supersetTheme, ThemeProvider } from '@superset-ui/style';

import '../src/theme.ts';
import './storybook.css';

const themeDecorator = storyFn => (
<ThemeProvider theme={supersetTheme}>{storyFn()}</ThemeProvider>
);

addDecorator(jsxDecorator);
addDecorator(themeDecorator);
addDecorator(withPaddings);

addParameters({
paddings: [
{ name: 'None', value: '0px' },
{ name: 'Small', value: '16px' },
{ name: 'Medium', value: '32px', default: true },
{ name: 'Large', value: '64px' },
],
});
3 changes: 3 additions & 0 deletions superset-frontend/.storybook/storybook.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body{
background: transparent;
}
Loading