How to use the @storybook/addon-info.withInfo 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 gremlin / chaoskit / .storybook / config.js View on Github external
addParameters({
  options: {
    brandName: 'ChaosKit',
    brandUrl: 'https://www.github.com/gremlin/chaoskit',
    hierarchySeparator: /\/|\./,
    hierarchyRootSeparator: /\|/,
  },
});

//
// Decorators
//

addDecorator(
  withInfo({
    header: false,
  }),
);
addDecorator(withKnobs);
addDecorator(withA11y);
addDecorator(story =&gt; <div>{story()}</div>);
addDecorator(centered);

//
// Load stories
//

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

function loadStories() {
  req.keys().forEach(filename =&gt; req(filename));
github carbon-design-system / carbon / packages / react / .storybook / config.js View on Github external
import React from 'react';
import { configure, addDecorator, addParameters } from '@storybook/react';
import addons from '@storybook/addons';
import { withInfo } from '@storybook/addon-info';
import { configureActions } from '@storybook/addon-actions';
// import { checkA11y } from 'storybook-addon-a11y';
import {
  CARBON_CURRENT_THEME,
  CARBON_TYPE_TOKEN,
} from './addon-carbon-theme/shared';
import Container from './Container';

const customPropertyPrefix = 'cds';

addDecorator(
  withInfo({
    styles: {
      children: {
        width: '100%',
      },
    },
    maxPropStringLength: 200, // Displays the first 200 characters in the default prop string
  })
);

addParameters({
  options: {
    theme: {
      brandTitle: 'carbon components react',
      brandUrl:
        'https://github.com/carbon-design-system/carbon/tree/master/packages/react',
    },
github storybookjs / storybook / examples / html-kitchen-sink / stories / react / addon-info.stories.js View on Github external
storiesOf('React|Info/ForwardRef', module)
  .addParameters({ framework: 'react' })
  .addDecorator(withInfo)
  .add('Displays forwarded ref components correctly', () =&gt; (
    
  ))
  .add('Uses forwardRef displayName if available', () =&gt; (
    
  ));

storiesOf('React|Info/deprecated', module)
  .addParameters({ framework: 'react' })
  .add(
    'Displays Markdown in description',
    withInfo(markdownDescription)(() =&gt; )
  );

storiesOf('React|Info/Story Source', module)
  .addParameters({ framework: 'react' })
  .addDecorator(withInfo)
  .add('One prop', () =&gt; )
  .add('Many props', () =&gt; )
  .add('Children', () =&gt; (
    <div>
      <p>Here is my nice button:</p>
      
    </div>
  ))
  .add('Array prop', () =&gt; {
    const propDefs = [
      {
github patternfly / patternfly-react / packages / patternfly-3 / patternfly-react / src / components / ExpandCollapse / ExpandCollapse.stories.js View on Github external
const stories = storiesOf(
  `${storybookPackageName(name)}/${STORYBOOK_CATEGORY.FORMS_AND_CONTROLS}/Expand Collapse`,
  module
);
stories.addDecorator(withKnobs);
stories.addDecorator(
  defaultTemplate({
    title: 'Expand Collapse',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_FORMS}expand-collapse-section/`
  })
);

stories.add(
  'ExpandCollapse',
  withInfo('This is the ExpandCollapse component.')(() =&gt; (
    <div style="{{">
      
        <p>Well done! The component takes 100% width by default and aligns the link to the left or center.</p>
        <p>And other text comes here.</p>
      
    </div>
  ))
);
github mashmatrix / react-lightning-design-system / stories / IconStories.js View on Github external
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { withInfo } from '@storybook/addon-info';
import { text, select } from '@storybook/addon-knobs';
import { Icon } from '../src/scripts';

const iconListItemStyle = {
  float: 'left', width: '10rem', height: '5rem', padding: '1.5rem', textAlign: 'center',
};

storiesOf('Icon', module)
  .add('Controlled with knobs', withInfo('Icon controlled with knobs')(() => {
    const categoryOptions = {
      '': '(none)',
      standard: 'standard',
      custom: 'custom',
      action: 'action',
      doctype: 'doctype',
      utility: 'utility',
    };
    const category = select('category', categoryOptions, 'standard');
    const sizeOptions = {
      '': '(none)',
      'x-small': 'x-small',
      small: 'small',
      medium: 'medium',
      large: 'large',
    };
github quran / common-components / src / SurahTitle / index.stories.js View on Github external
storiesOf('SurahTitle', module)
  .addDecorator(story =&gt; (
    <div style="{{">
      <style>
        {`
          body{ margin: 0px; }
          .quran__ChapterOne path {
            fill: green;
          }
          .quran__ChapterOne{ background: orange;}
        `}
      </style>
      {story()}
    </div>
  ))
  .add('default', withInfo('default')(() =&gt; ))
  .add(
    'color props',
    withInfo('color props')(() =&gt; ),
  )
  .add(
    'style props',
    withInfo('style props')(() =&gt; (
      
    )),
  )
  .add(
    'style fill via css (classname)',
github getsentry / sentry / docs-ui / components / loadingError.stories.js View on Github external
import {storiesOf} from '@storybook/react';
import {action} from '@storybook/addon-actions';
import {withInfo} from '@storybook/addon-info';

import LoadingError from 'app/components/loadingError';

storiesOf('UI|Loaders/LoadingError', module)
  .add(
    'default',
    withInfo('Loading error with default message')(() =&gt; (
      
    ))
  )
  .add(
    'custom message',
    withInfo('Loading error with custom message')(() =&gt; (
      
    ))
  );
github mashmatrix / react-lightning-design-system / stories / SelectStories.js View on Github external
.add('Controlled with knobs', withInfo('Select controlled with knobs')(() =&gt; (
    <select disabled="{" value="{" required="{" label="{">
      <option value="1" label="Option One">
      </option><option value="2" label="Option Two">
      </option><option value="3" label="Option Three">
    </option></select>
  )))
  .add('Default', withInfo('Default Select control')(() =&gt; (
    <select label="Select Label">
      <option value="1" label="Option One">
      </option><option value="2" label="Option Two">
      </option><option value="3" label="Option Three">
    </option></select>
  )))
  .add('Required', withInfo('Select control with required attribute')(() =&gt; (
github getsentry / sentry / docs-ui / components / tag.stories.js View on Github external
import React from 'react';
import {storiesOf} from '@storybook/react';
import {withInfo} from '@storybook/addon-info';

import Tooltip from 'app/components/tooltip';
import Tag from 'app/views/settings/components/tag';

storiesOf('UI|Tags', module)
  .add(
    'default',
    withInfo('A basic tag-like thing. If you pass no type, it will be gray')(() =&gt; (
      Development
    ))
  )
  .add(
    'warning',
    withInfo(
      'A warning tag-like thing. Use this to signal that something is maybe not so great'
    )(() =&gt; Development)
  )
  .add(
    'success',
    withInfo('A happy tag-like thing. Use this to signal something good')(() =&gt; (
      Development
    ))
  )
  .add(
github quran / common-components / src / Tabs / index.stories.js View on Github external
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import Tabs, { Tab } from './index';

import { withInfo } from '@storybook/addon-info';

storiesOf('Tabs', module)
  .add('default', withInfo('default')(() =&gt; (
    
      Some info 1
      Some info 2
      Some info 3
    
  )))
  .add('with onClick handler', withInfo('with onClick handler')(() =&gt; (
    
      Some info 1
      Some info 2
      Some info 3
    
  )))
  .add('selected props', withInfo('selected props')(() =&gt; (
    
      Some info 1