Skip to content

Commit

Permalink
feat: add basic local storybook implementation for newspack-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasguillot committed Feb 22, 2025
1 parent 01c34f8 commit 4315e2d
Show file tree
Hide file tree
Showing 10 changed files with 15,749 additions and 1,916 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@ module.exports = {
newspack_aux_data: 'readonly',
},
ignorePatterns: [ '*/dist/', '*/node_modules/', '*/release' ],
overrides: [
{
files: [ '.storybook/**/*.js' ],
rules: {
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': 'off'
}
}
]
};
31 changes: 31 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const config = {
stories: [
'../storybook/**/*.mdx',
'../storybook/**/*.stories.@(js|jsx|mjs|ts|tsx)',
'../src/**/*.mdx',
'../src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
docs: {
autodocs: 'tag',
},
webpackFinal: async (config) => {
// Add SASS support
config.module.rules.push({
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
});

return config;
},
};

export default config;
23 changes: 23 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import '../src/newspack-ui/style.scss';

/** @type { import('@storybook/react').Preview } */
const preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
decorators: [
(Story) => (
<div style={{ margin: '2em' }}>
<Story />
</div>
),
],
};

export default preview;
Loading

0 comments on commit 4315e2d

Please sign in to comment.