How to use the @storybook/addon-backgrounds.default function in @storybook/addon-backgrounds

To help you get started, we’ve selected a few @storybook/addon-backgrounds 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 isuvorov / storybox / src / wrapModule.js View on Github external
const createStoriesOf = ({ storybook, React, ...config }) => (...args) => {

  // if (DEBUG) console.log('storiesOf');
  const res = storybook.storiesOf(...args);

  if (config.notes) {
    res.addDecorator(require('@storybook/addon-notes').withNotes);
  }
  if (config.backgrounds) {
    res.addDecorator(require('@storybook/addon-backgrounds').default(config.backgrounds));
  }

  // if (config.info) {
  if (false) {
    res._add = res.add; // eslint-disable-line  no-underscore-dangle
    res.add = (...args2) => {
      if (DEBUG) console.log('res.add');

      if (res.inAdd) {
        return res._add(...args); // eslint-disable-line  no-underscore-dangle
      }
      res.inAdd = true;
      const result = res.addWithInfo ? res.addWithInfo(...args2) : res._add(...args2); // eslint-disable-line  no-underscore-dangle
      res.inAdd = false;
      return result;
    };

@storybook/addon-backgrounds

Switch backgrounds to view components in different settings

MIT
Latest version published 9 days ago

Package Health Score

95 / 100
Full package analysis