How to use the @storybook/addons.types.PREVIEW function in @storybook/addons

To help you get started, we’ve selected a few @storybook/addons 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 storybookjs / storybook / addons / a11y / src / register.tsx View on Github external
addons.add(PANEL_ID, {
    title: '',
    type: types.TOOL,
    match: ({ viewMode }) => viewMode === 'story',
    render: () => ,
  });

  addons.add(PANEL_ID, {
    title: 'Accessibility',
    type: types.PANEL,
    render: ({ active, key }) => ,
  });

  addons.add(PANEL_ID, {
    title: '',
    type: types.PREVIEW,
    render: PreviewWrapper as any,
  });
});
github storybookjs / storybook / addons / a11y / src / register.tsx View on Github external
title: '',
    type: types.TOOL,
    match: ({ viewMode }) => viewMode === 'story',
    render: () => ,
  });

  addons.add(PANEL_ID, {
    title: 'Accessibility',
    type: types.PANEL,
    render: ({ active, key }) => ,
    paramKey: PARAM_KEY,
  });

  addons.add(PANEL_ID, {
    title: '',
    type: types.PREVIEW,
    render: PreviewWrapper as any,
  });
});
github storybookjs / storybook / lib / components / src / preview / preview.js View on Github external
const {
      id,
      path,
      location,
      viewMode,
      storyId,
      getElements,
      actions,
      options,
      description,
      baseUrl,
    } = this.props;

    const toolbarHeight = options.isToolshown ? 40 : 0;

    const wrappers = getElementList(getElements, types.PREVIEW, defaultWrappers);
    const panels = getElementList(getElements, types.TAB, [
      {
        route: p => `/story/${p.storyId}`,
        match: p => p.viewMode === 'story',
        render: p => (
          
        ),
        title: 'Canvas',
        id: 'canvas',
      },
github storybookjs / storybook / lib / ui / src / components / preview / preview.js View on Github external
path,
      location,
      viewMode,
      docsOnly,
      storyId,
      queryParams,
      getElements,
      api,
      customCanvas,
      options,
      description,
      baseUrl,
    } = this.props;

    const toolbarHeight = options.isToolshown ? 40 : 0;
    const wrappers = getElementList(getElements, types.PREVIEW, defaultWrappers);
    const panels = getElementList(getElements, types.TAB, [
      {
        route: p => `/story/${p.storyId}`,
        match: p => p.viewMode && p.viewMode.match(/^(story|docs)$/),
        render: p => (
          
            {({ value }) => {
              const props = {
                viewMode,
                active: p.active,
                wrappers,
                id,
                storyId,
                baseUrl,
                queryParams,
                scale: value,
github storybookjs / storybook / lib / ui / src / components / preview / preview.tsx View on Github external
path,
      location,
      viewMode = 'story',
      storyId = '',
      queryParams,
      getElements,
      api,
      customCanvas,
      options,
      description,
      frames = {},
      story,
    }: PreviewProps = this.props;
    const currentUrl = story && getUrl(story);
    const toolbarHeight = options.isToolshown ? 40 : 0;
    const wrappers = getElementList(getElements, types.PREVIEW, defaultWrappers);
    const panels = getElementList(getElements, types.TAB, [
      {
        route: (p: { storyId: string }) => `/story/${p.storyId}`,
        match: (p: { viewMode: ViewMode }) => p.viewMode && p.viewMode.match(/^(story|docs)$/),
        render: (p: { viewMode: ViewMode; active: boolean }) => (
          
            {({ value }) => {
              const props = {
                viewMode,
                active: p.active,
                wrappers,
                storyId,
                queryParams,
                scale: value,
                customCanvas,
              };