How to use the @storybook/addon-info.setDefaults function in @storybook/addon-info

To help you get started, we’ve selected a few @storybook/addon-info 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 mashmatrix / react-lightning-design-system / .storybook / config.js View on Github external
import infoAddonDefaults from './infoAddonDefaults';

let assetRoot;
if (typeof location !== 'undefined') {
  if (/\.sbook\.io/.test(location.hostname)) {
    // As storybook hub cannot host the static files, use the externally hosted SLDS assets (CORS enabled)
    assetRoot = '//mashmatrix.github.io/react-lightning-design-system/assets';
    // As SVG doesn't allow the use of cross-domain external resources (even CORS header is set in resource server)
    // forcedly use svg4everybody polyfill
    svg4everybody({ polyfill: true });
  } else if (location.hostname === 'mashmatrix.github.io') {
    assetRoot = '//mashmatrix.github.io/react-lightning-design-system/assets';
  }
}

setDefaults(infoAddonDefaults);
setAddon(infoAddon);
addDecorator(withKnobs);
addDecorator(wrapContent({ assetRoot }));

configure(() => {
  require('../stories/index.js');
}, module);