How to use the @storybook/react.getStorybook function in @storybook/react

To help you get started, we’ve selected a few @storybook/react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / react-instantsearch / test / regressions / tests.js View on Github external
function normalize(string) {
  return string.replace(/[ -/]/g, '_');
}

// Remove the GeoSearch stories from the
// tests because they are too brittle
const stories = require.context(
  '../../stories',
  true,
  /^((?!GeoSearch).)*\.stories\.js$/
);

// loadStories
stories.keys().forEach(filename => stories(filename));
const tests = getStorybook().reduce((acc, book) => {
  book.stories.forEach(story => {
    acc.push({
      suite: normalize(book.kind),
      name: normalize(story.name),
      case: story.render,
      context: {
        kind: book.kind,
        story: story.name,
      },
    });
  });

  return acc;
}, []);

let interval;
github elastic / elastic-charts / integration / helpers.ts View on Github external
export function getStorybookInfo(): StoryGroupInfo[] {
  requireAllStories();

  return getStorybook()
    .filter(({ kind }) => kind)
    .map(({ kind: group, stories: storiesRaw }) => {
      const stories: StoryInfo[] = storiesRaw
        .filter(({ name }) => name)
        .map(({ name: title }) => {
          // cleans story name to match url params
          const encodedTitle = encodeString(title);

          return {
            title,
            encodedTitle,
          };
        });

      const encodedGroup = encodeString(group);
github flow-typed / flow-typed / definitions / npm / @storybook / react_v5.x.x / flow_v0.104.x- / test_react_v5.x.x.js View on Github external
it('should validate on default usage', () => {
    getStorybook().forEach(({ kind, stories }) =>
      stories.forEach(({ name, render }) => render())
    );
  });
});
github flow-typed / flow-typed / definitions / npm / @storybook / react_v3.x.x / flow_v0.104.x- / test_react_v3.x.x.js View on Github external
it('should validate on default usage', () => {
    getStorybook().forEach(({ kind, stories }) =>
      stories.forEach(({ name, render }) => render())
    );
  });
});
github flow-typed / flow-typed / definitions / npm / @storybook / react_v4.x.x / flow_v0.104.x- / test_react_v4.x.x.js View on Github external
it('should validate on default usage', () => {
    getStorybook().forEach(({ kind, stories }) =>
      stories.forEach(({ name, render }) => render())
    );
  });
});
github Financial-Times / x-dash / packages / x-workbench / index.js View on Github external
function getComponents() {
	loadStories();
	return getStorybook();
}
github bbc / psammead / packages / utilities / psammead-storybook-helpers / src / buildRTLSubstories.js View on Github external
export default () => {
  getStorybook().forEach(({ kind, stories }) => {
    stories.forEach(({ name, render }) => {
      storiesOf(`${kind}/RTL`, module)
        .addDecorator(withServicesKnob({ defaultService: 'arabic' }))
        .add(`RTL - ${name}`, render);
    });
  });
};
github algolia / react-instantsearch / integration / getStorybookStories.js View on Github external
const getStorybookStories = ({ host, port }) =>
  getStorybook().reduce(
    (acc, { kind, stories }) =>
      acc.concat(
        stories.map(({ name }) => ({
          kind: normalize(kind),
          name: normalize(name),
          url: createStoryURL({
            query: createStoryQueryParameters(kind, name),
            host,
            port,
          }),
        }))
      ),
    []
  );
github firefox-devtools / debugger / .storybook / config.js View on Github external
function loadStories() {
  require("../src/components/stories/tabs.js");
  require("../src/components/stories/frames.js");
  require("../src/components/stories/Preview.js");
  require("../src/components/stories/Outline.js");
  require("../src/components/stories/SearchInput.js");
  require("../src/components/stories/ResultList.js");
  require("../src/components/stories/ManagedTree.js");
  require("../src/components/stories/Workers.js");
}

configure(loadStories, module);

if (typeof window === "object") {
  window.__storybook_stories__ = getStorybook();
}