How to use the @storybook/react.setAddon function in @storybook/react

To help you get started, we’ve selected a few @storybook/react 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 olymp / olymp / packages / icons / .storybook / config.tsx View on Github external
import PropTypes from 'prop-types';
import PropVal from '@storybook/addon-info/dist/components/PropVal';
import { configure, setAddon } from '@storybook/react';
import infoAddon from '@storybook/addon-info';

// temp fix PropVal.propTypes
// https://github.com/storybooks/storybook/issues/1305
PropVal.propTypes = {
  ...PropVal.propTypes,
  maxPropObjectKeys: PropTypes.number,
  maxPropArrayLength: PropTypes.number,
  maxPropStringLength: PropTypes.number,
};

setAddon(infoAddon);
configure(() => require('./fa5'), module);
github jakubjafra / react-native-hybrid-storybook / src / web / storybook / config.js View on Github external
autoResolveReq.keys().forEach(autoResolveReq);
    }

    defaultResolveReq.keys().forEach(defaultResolveReq);
}

chaptersAddonSetDefaults({
    sectionOptions: {
        useTheme: true, // TODO: Make own distinct theme
        showSource: false,
        allowSourceToggling: true,
        showPropTables: false,
        allowPropTablesToggling: true,
    },
});
setAddon(chaptersAddon);

addDecorator(withKnobs);

setOptions(addonOptions);

configure(loadStories, module);
github Vizzuality / trase / frontend / .storybook / config.js View on Github external
import { setAddon, configure, addParameters } from '@storybook/react';
import JSXAddon from 'storybook-addon-jsx';
import './storybook.scss';
import theme from './theme';

addParameters({ options: { theme } });
setAddon(JSXAddon);
// automatically import all files ending in *.stories.js
const req = require.context('../stories', true, /\.stories\.(jsx?|mdx)$/);
function loadStories() {
  req.keys().forEach(filename => req(filename));
}

configure(loadStories, module);
github flow-typed / flow-typed / definitions / npm / @storybook / react_v5.x.x / flow_v0.104.x- / test_react_v5.x.x.js View on Github external
it('should validate on default usage', () => {
    interface Addon {
      test(name: string, story: RenderFunction): Story & T;
    }

    const TestAddon: Addon = {
      test(name, story) {
        console.log(this.kind === 'TestAddon');
        return this.add(name, story);
      },
    };

    setAddon(TestAddon);

    storiesOf('TestAddon', module)
      .test('', () =&gt; <div>)
      .test('', () =&gt; <div>)
      .add('', () =&gt; <div>)
      .test('', () =&gt; <div>)
      .add('', () =&gt; <div>, parameters);
  });
});</div></div></div></div></div>
github uber / react-vis / website / storybook / index.js View on Github external
import {setAddon} from '@storybook/react';
import JSXAddon from 'storybook-addon-jsx';
setAddon(JSXAddon);

import '../../dist/style.css';
import '../.storybook/storybook.css';

import './areaseries-story';
import './barseries-story';
import './lineseries-story';
import './markseries-story';
import './radial-story';

import './axis-story';
import './legend-story';
github sm-react / storybook-chapters / example / basic / .storybook / config.js View on Github external
import * as storybook from '@storybook/react';
import { setOptions } from '@storybook/addon-options';
import infoAddon from '@storybook/react-addon-info';
import 'storybook-chapters';

storybook.setAddon(infoAddon);

setOptions({
    name: 'React Theming',
    url: 'https://github.com/sm-react/react-theming',
    goFullScreen: false,
    showLeftPanel: true,
    showDownPanel: true,
    showSearchBox: false,
    downPanelInRight: false,
});

storybook.configure(
    () => {
      require('../src/stories');
      require('../src/ThemeSwitcher.story');
      require('../src/MaterialUI/index.story');
github codesandbox / codesandbox-client / standalone-packages / react-sandpack / stories / OpenInCodeSandbox.js View on Github external
import React from 'react';
import JSXAddon from 'storybook-addon-jsx';
import { storiesOf, setAddon } from '@storybook/react';

import SandpackProvider from '../src/components/SandpackProvider/index.ts';
import OpenInCodeSandbox from '../src/components/OpenInCodeSandbox/index.ts';

setAddon(JSXAddon);

const stories = storiesOf('Export To CodeSandbox', module);

stories.addWithJSX('minimal', () =&gt; (
  
    
  
));
github ElectronHacked / nextjs-typescript-antd / generators / app / templates / _storybook / config.js View on Github external
{
      name: 'Twitter',
      value: '#00aced',
    },
    {
      name: 'Facebook',
      value: '#3b5998',
    },
  ],
  options: {
    showAddonPanel: true,
    theme: customTheme,
  },
});

setAddon(JSXAddon);

const req = require.context('../stories', true, /.stories.tsx$/);

function loadStories() {
  require('./welcomeStory');
  req.keys().forEach(filename => req(filename));
}

configure(loadStories, module);
github uber / react-vis / website / storybook / barseries-story.js View on Github external
import React from 'react';

import {setAddon, storiesOf} from '@storybook/react';
import JSXAddon from 'storybook-addon-jsx';

setAddon(JSXAddon);
import {
  withKnobs,
  color,
  number,
  object,
  text
} from '@storybook/addon-knobs/react';

import {HorizontalBarSeries, VerticalBarSeries} from 'react-vis';

import {generateLinearData, intRandom, random} from './storybook-data.js';
import {
  chooseColorScale,
  SimpleChartWrapper,
  jsxOptions
} from './storybook-utils.js';
github vrk-kpa / suomifi-ui-components / .storybook / config.js View on Github external
import { configure } from '@storybook/react';
import { setAddon, addDecorator } from '@storybook/react';
import JSXAddon from 'storybook-addon-jsx';
import { withKnobs } from '@storybook/addon-knobs/react';
addDecorator(withKnobs);
setAddon(JSXAddon);

const req = require.context('../src', true, /.stories.tsx$/);

function loadStories() {
  require('./welcomeStory');
  req.keys().forEach(filename => req(filename));
}

configure(loadStories, module);