How to use the @storybook/addons.getChannel 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 berty / berty / js / packages / components / storybook.tsx View on Github external
addons.register('i18n', () => {
	const channel = addons.getChannel()
	addons.addPanel('i18n', {
		title: 'language',
		// eslint-disable-next-line react/prop-types
		render: () =>
			React.createElement(() => {
				return (
					
				)
			}),
github truffls / storybook-addon-intl / src / preview / index.js View on Github external
export const setIntlConfig = (config) => {
    _config = config;

    const channel = addons.getChannel();
    channel.emit(EVENT_SET_CONFIG_ID, {
        locales: config.locales,
        defaultLocale: config.defaultLocale
    });
};
github tuchk4 / storybook-readme / packages / storybook-readme / env / common / index.js View on Github external
function renderStory(_ref) {
  var docs = _ref.docs,
    config = _ref.config,
    storyFn = _ref.storyFn,
    kind = _ref.kind,
    story = _ref.story;

  addons.getChannel().emit(ADD_DOC_EVENT, {
    kind: kind,
    storyName: story,
    docs: docs,
  });

  return storyFn({ kind: kind, story: story });
}
github storybookjs / storybook / addons / knobs / src / polymer / index.js View on Github external
function wrapperKnobs(options) {
  const channel = addons.getChannel();
  manager.setChannel(channel);

  if (options) channel.emit('addon:knobs:setOptions', options);

  return polymerHandler(channel, manager.knobStore);
}
github tuchk4 / storybook-readme / packages / storybook-readme / src / env / common / index.js View on Github external
function renderStory({ docs, config, storyFn, kind, story }) {
  addons.getChannel().emit(ADD_DOC_EVENT, {
    kind,
    storyName: story,
    docs,
  });

  return storyFn({ kind, story });
}
github tuchk4 / storybook-readme / packages / storybook-readme / src / index.js View on Github external
wrapper: (getStory, context) => {
    const parameters = getParameters(context);
    const story = {getStory(context)};
    const layout = parameters.layout
      ? parameters.layout
      : getDocsLayout({
          footer: parameters.footer || '',
          header: parameters.header || '',
          md: parameters.content || '',
          excludePropTables: parameters.excludePropTables || [],
          includePropTables: parameters.includePropTables || [],
          story,
        });

    const channel = addons.getChannel();

    if (parameters.sidebar) {
      const sidebarLayout = getDocsLayout({
        footer: parameters.footer || '',
        header: parameters.header || '',
        md: parameters.sidebar,
        excludePropTables: parameters.excludePropTables || [],
        includePropTables: parameters.includePropTables || [],
        story,
      });

      channel.emit(CHANNEL_SET_SIDEBAR_DOCS, {
        layout: sidebarLayout,
        theme: parameters.theme,
        codeTheme: parameters.highlightSidebar ? parameters.codeTheme : null,
      });
github storybookjs / storybook / app / react-native / src / preview / index.tsx View on Github external
_selectStory(story: any) {
    const channel = addons.getChannel();

    this._stories.setSelection({ storyId: story.id, viewMode: 'story' }, null);
    channel.emit(Events.SELECT_STORY, story);
  }
github storybookjs / storybook / app / react-native / src / preview / components / StoryListView / index.tsx View on Github external
componentDidMount() {
    const channel = addons.getChannel();
    channel.on(Events.STORY_ADDED, this.handleStoryAdded);
    channel.on(Events.SELECT_STORY, this.forceReRender);
    this.handleStoryAdded();
  }
github ticketmaster / storybook-styled-components / src / index.js View on Github external
export const withThemes = themes => (storyFn, context) => {
  const channel = addons.getChannel();
  return (
    {storyFn(context)}
    
  )
}