Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addons.register('i18n', () => {
const channel = addons.getChannel()
addons.addPanel('i18n', {
title: 'language',
// eslint-disable-next-line react/prop-types
render: () =>
React.createElement(() => {
return (
)
}),
export const setIntlConfig = (config) => {
_config = config;
const channel = addons.getChannel();
channel.emit(EVENT_SET_CONFIG_ID, {
locales: config.locales,
defaultLocale: config.defaultLocale
});
};
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 });
}
function wrapperKnobs(options) {
const channel = addons.getChannel();
manager.setChannel(channel);
if (options) channel.emit('addon:knobs:setOptions', options);
return polymerHandler(channel, manager.knobStore);
}
function renderStory({ docs, config, storyFn, kind, story }) {
addons.getChannel().emit(ADD_DOC_EVENT, {
kind,
storyName: story,
docs,
});
return storyFn({ kind, story });
}
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,
});
_selectStory(story: any) {
const channel = addons.getChannel();
this._stories.setSelection({ storyId: story.id, viewMode: 'story' }, null);
channel.emit(Events.SELECT_STORY, story);
}
componentDidMount() {
const channel = addons.getChannel();
channel.on(Events.STORY_ADDED, this.handleStoryAdded);
channel.on(Events.SELECT_STORY, this.forceReRender);
this.handleStoryAdded();
}
render: () => ,
})
export const withThemes = themes => (storyFn, context) => {
const channel = addons.getChannel();
return (
{storyFn(context)}
)
}