woocommerce/tools/storybook/.storybook/main.js

78 lines
2.4 KiB
JavaScript
Raw Normal View History

const webpackOverride = require( '../webpack.config' );
module.exports = {
core: {
builder: 'webpack5',
},
stories: [
// WooCommerce Admin / @woocommerce/components components
'../../../packages/js/components/src/**/stories/*.@(js|tsx)',
// WooCommerce Admin / @woocommerce/experimental components
'../../../packages/js/experimental/src/**/stories/*.@(js|tsx)',
// WooCommerce Admin / @woocommerce/onboarding components
'../../../packages/js/onboarding/src/**/stories/*.@(js|tsx)',
[DataView]: Add Products View and Product Edit stories (#50999) * Product Editor: add storybook * fix storybook * Add products data views list * Add navigation on the left * Update edit site package * Fix styling * Add changelog * Add wp/icons package to syncpack exception list * Delete some unused stuff and address types * Add changelog * Remove un needed css * Remove dependency on edit-site package * WIP * WIP * WIP * Fix storybook build * Ignore storybook from version pinning * add slug stories * Add products data views list * Add navigation on the left * Update edit site package * Fix styling * Add changelog * Add wp/icons package to syncpack exception list * Delete some unused stuff and address types * Add changelog * Remove un needed css * Remove dependency on edit-site package * Fix custom status filters * Make sure page size works with view config * improve storybook * rename file * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor * Remove use of canvasMode and navigation context as it is not needed * Remove wordpress/dom from syncpack * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor, woocommerce * add edit-site style * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor * remove not necessary file * address feedback * fix webpack configuration * fix lint errors --------- Co-authored-by: Lourens Schep <lourensschep@gmail.com> Co-authored-by: Sam Seay <samueljseay@gmail.com> Co-authored-by: github-actions <github-actions@github.com>
2024-09-03 14:09:54 +00:00
'../../../packages/js/product-editor/src/**/*.stories.@(js|tsx)',
'../../../plugins/woocommerce-admin/client/**/stories/*.@(js|tsx)',
],
addons: [
'@storybook/addon-docs',
'@storybook/addon-controls',
// This package has been deprecated, in favor of @storybook/addon-controls
// However, it is still needed for the <Timeline /> story because changing the values with @storybook/addon-controls makes it crash. It seems that we cannot have jsx elements in props.
'@storybook/addon-knobs',
'@storybook/addon-viewport',
'@storybook/addon-a11y',
'@storybook/addon-actions',
'@storybook/addon-links',
],
typescript: {
reactDocgen: 'react-docgen-typescript',
},
staticDirs: [
{
from: '../../../plugins/woocommerce-admin/client',
to: 'main/plugins/woocommerce-admin/client',
},
],
webpackFinal: webpackOverride,
previewHead: ( head ) => `
${ head }
${
process.env.USE_RTL_STYLE === 'true'
? `
<link href="experimental-css/style-rtl.css" rel="stylesheet" />
<link href="component-css/style-rtl.css" rel="stylesheet" />
<link href="onboarding-css/style-rtl.css" rel="stylesheet" />
<link href="product-editor-css/style-rtl.css" rel="stylesheet" />
<link href="app-css/style-rtl.css" rel="stylesheet" />
`
: `
<link href="component-css/style.css" rel="stylesheet" />
<link href="experimental-css/style.css" rel="stylesheet" />
<link href="onboarding-css/style.css" rel="stylesheet" />
<link href="product-editor-css/style.css" rel="stylesheet" />
<link href="app-css/style.css" rel="stylesheet" />
`
}
<style>
/* Use system font, consistent with WordPress core (wp-admin) */
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}
</style>
`,
previewBody: ( body ) => `
<div id="wpwrap">
<div class="woocommerce-layout woocommerce-admin-page">
${ body }
`,
};