How to use storybook - 10 common examples

To help you get started, we’ve selected a few storybook 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 patternfly / patternfly-react / packages / patternfly-3 / patternfly-react / src / components / VerticalNav / VerticalNav.stories.js View on Github external
>
    <div>
      <p>Body Content Here! Body Content Here! Body Content Here! 1</p>
      <p>Body Content Here! Body Content Here! Body Content Here! 2</p>
      <p>Body Content Here! Body Content Here! Body Content Here! 3</p>
      <p>Body Content Here! Body Content Here! Body Content Here! 4</p>
      <p>Body Content Here! Body Content Here! Body Content Here! 5</p>
    </div>
  
);

// TODO: we should fix this issue and remove this message.
const propTypesAreBroke = `***Note: Prop Type descriptions are missing on this page
due to a Storybook bug. Please see the source code for propType description comments.***`;

const stories = storiesOf(`${storybookPackageName(name)}/${STORYBOOK_CATEGORY.NAVIGATION}/Vertical Navigation`, module);
stories.addDecorator(withKnobs);
stories.addDecorator(
  defaultTemplate({
    title: 'Vertical Navigation',
    description: 'Please click "Show Info" for example source and component documentation.',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_NAVIGATION}vertical-navigation/`
  })
);

stories.add(
  'Items as JSX',
  withInfo({
    propTablesExclude: [MockFixedLayout],
    text: `Example with simple masthead and navigation items expressed as simple JSX children.\n
Tips:\n
* You can save some typing in your JSX by importing the child components like this:
github patternfly / patternfly-react / packages / patternfly-3 / patternfly-react / src / components / VerticalNav / VerticalNav.stories.js View on Github external
<p>Body Content Here! Body Content Here! Body Content Here! 5</p>
    
  
);

// TODO: we should fix this issue and remove this message.
const propTypesAreBroke = `***Note: Prop Type descriptions are missing on this page
due to a Storybook bug. Please see the source code for propType description comments.***`;

const stories = storiesOf(`${storybookPackageName(name)}/${STORYBOOK_CATEGORY.NAVIGATION}/Vertical Navigation`, module);
stories.addDecorator(withKnobs);
stories.addDecorator(
  defaultTemplate({
    title: 'Vertical Navigation',
    description: 'Please click "Show Info" for example source and component documentation.',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_NAVIGATION}vertical-navigation/`
  })
);

stories.add(
  'Items as JSX',
  withInfo({
    propTablesExclude: [MockFixedLayout],
    text: `Example with simple masthead and navigation items expressed as simple JSX children.\n
Tips:\n
* You can save some typing in your JSX by importing the child components like this:
\`\`\`\nimport { VerticalNav } from 'patternfly-react';
const { Masthead, Brand, IconBar, Item, SecondaryItem, TertiaryItem } = VerticalNav;
\`\`\`\n
* To control what happens on item selection, you can either pass an **href** or an **onClick**
prop to the item, or you can pass an **onItemClick** and/or **onNavigate** prop to VerticalNav, or both.\n
* To control which item is active, pass the **active** prop to an item. Otherwise,
github patternfly / patternfly-react / packages / patternfly-react / src / components / VerticalNav / VerticalNav.stories.js View on Github external
<p>Body Content Here! Body Content Here! Body Content Here! 5</p>
    
  
);

// TODO: we should fix this issue and remove this message.
const propTypesAreBroke = `***Note: Prop Type descriptions are missing on this page
due to a Storybook bug. Please see the source code for propType description comments.***`;

const stories = storiesOf(`${storybookPackageName(name)}/${STORYBOOK_CATEGORY.NAVIGATION}/Vertical Navigation`, module);
stories.addDecorator(withKnobs);
stories.addDecorator(
  defaultTemplate({
    title: 'Vertical Navigation',
    description: 'Please click "Show Info" for example source and component documentation.',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_NAVIGATION}vertical-navigation/`
  })
);

stories.add(
  'Items as JSX',
  withInfo({
    propTablesExclude: [MockFixedLayout],
    text: `Example with simple masthead and navigation items expressed as simple JSX children.\n
Tips:\n
* You can save some typing in your JSX by importing the child components like this:
\`\`\`\nimport { VerticalNav } from 'patternfly-react';
const { Masthead, Brand, IconBar, Item, SecondaryItem, TertiaryItem } = VerticalNav;
\`\`\`\n
* To control what happens on item selection, you can either pass an **href** or an **onClick**
prop to the item, or you can pass an **onItemClick** and/or **onNavigate** prop to VerticalNav, or both.\n
* To control which item is active, pass the **active** prop to an item. Otherwise,
github mediamonks / muban / build-tools / generator-template / component / {name_sc} / preset.js View on Github external
/* eslint-disable max-len */
import { storiesOf } from 'storybook/utils/utils';

storiesOf('{{name_sc}}', require('./{{name_sc}}.hbs')).add(
  'default',
  'No description yet...',
  `
      \{{&gt; {{name_sc}} @root}}
    `,
  {},
);
github mediamonks / muban / src / app / component / block / header / preset.js View on Github external
/* eslint-disable max-len */
import { storiesOf } from 'storybook/utils/utils';

storiesOf('Header', require('./header.hbs')).add(
  'default',
  'The header that we show on each page of the website, contains the navigation.',
  `
			{{&gt; header }}
		`,
);
github mediamonks / muban / src / app / component / block / footer / preset.js View on Github external
/* eslint-disable max-len */
import { storiesOf } from 'storybook/utils/utils';

storiesOf('Footer', require('./footer.hbs')).add(
  'default',
  'The footer that we show on each page of the website, contains the copyright.',
  `
			{{&gt; footer }}
		`,
);
github mediamonks / muban / build-tools / generator-template / block / {name_sc} / preset.js View on Github external
/* eslint-disable max-len */
import { storiesOf } from 'storybook/utils/utils';

storiesOf('{{name_sc}}', require('./{{name_sc}}.hbs')).add(
  'default',
  'No description yet...',
  `
      \{{&gt; block/{{name_sc}} @root}}
    `,
  require('./data/default'),
);
github mediamonks / muban / src / app / component / block / paragraph / preset.js View on Github external
/* eslint-disable max-len */
import { storiesOf } from 'storybook/utils/utils';

storiesOf('Paragraph', require('./paragraph'))
  .add(
    'default',
    'A Paragraph block with a "read more" section you can show by clicking a button.',
    `
      {{&gt; paragraph @root }}
    `,
    require('./data/data'),
  )
  .add(
    'no more content',
    'Without more content, hides the button',
    `
      <div style="max-width: 400px;">
        {{&gt; paragraph @root }}
      </div>
    `,
github mediamonks / muban / build-tools / generator-template / smart-component / {name_sc} / preset.js View on Github external
/* eslint-disable max-len */
import { storiesOf } from 'storybook/utils/utils';

storiesOf('{{name_sc}}', require('./{{name_sc}}.hbs')).add(
  'default',
  'No description yet...',
  `
      \{{&gt; {{name_sc}} @root}}
    `,
  {},
);
github mediamonks / muban / src / app / component / block / two-col / preset.js View on Github external
/* eslint-disable max-len */
import { storiesOf } from 'storybook/utils/utils';

storiesOf('Two Col', require('./two-col'))
  .add(
    'default',
    'A block that has two columns of text, each with its own title.',
    `
      {{&gt; two-col @root }}
    `,
    require('./data/data'),
  )
  .add(
    'small',
    'A smaller wrapper around the two colomns.',
    `
      <div style="max-width: 600px">
        {{&gt; two-col @root }}
      </div>
    `,