static getDerivedStateFromProps(nextProps, prevState) { console.log( 'state', nextProps.context.kind !== prevState.context.kind || nextProps.context.story !== prevState.context.story, nextProps.context.kind !== prevState.context.kind, nextProps.context.story !== prevState.context.story, nextProps.context, prevState.context ); if ( nextProps.context.kind !== prevState.context.kind || nextProps.context.story !== prevState.context.story ) { //nextProps.story.addParameters({ jest: ['Card-test'] }); window.scrollTo(0, 0); if (nextProps.context.story.includes('html')) { withOptions({ selectedAddonPanel: 'lucid-docs-panel-code' }); } else if (nextProps.context.story.includes('Right to left')) { withOptions({ selectedAddonPanel: 'storybook/rtl' }); } else { withOptions({ selectedAddonPanel: 'REACT_STORYBOOK/readme/panel' }); } return { context: nextProps.context, }; } else return null; }
import { configure, addDecorator } from '@storybook/react'; import { withOptions } from '@storybook/addon-options'; import { version } from '../package.json'; const req = require.context('./stories', true, /.js*/); function loadStories() { req.keys().forEach((filename) => req(filename)); require('./styles/styles.scss'); } addDecorator( withOptions({ name: `react-intl-tel-input v${version}`, url: 'https://github.com/patw0929/react-intl-tel-input', sidebarAnimations: true, }) ); configure(loadStories, module);
// Add optional knobs to customize each story. addDecorator(withKnobs); } function loadStories() { // Pull in the built CSS produced by the Kibana server const css = require.context('../../../../built_assets/css', true, /light.css$/); css.keys().forEach(filename => css(filename)); // Include the legacy styles const uiStyles = require.context('../../../../src/legacy/ui/public/styles', false, /[\/\\](?!mixins|variables|_|\.|bootstrap_(light|dark))[^\/\\]+\.less/); uiStyles.keys().forEach(key => uiStyles(key)); // Find all files ending in *.examples.ts const req = require.context('./..', true, /.examples.tsx$/); req.keys().forEach(filename => req(filename)); } // Set up the Storybook environment with custom settings. addDecorator( withOptions({ goFullScreen: false, name: 'Canvas Storybook', showAddonsPanel: true, url: 'https://github.com/elastic/kibana/tree/master/x-pack/plugins/canvas' }) ); configure(loadStories, module);