How to use the storybook/decorators/storyTemplates.defaultTemplate function in storybook

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-react / src / components / Slider / Slider.stories.js View on Github external
import { storiesOf } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';
import { defaultTemplate } from 'storybook/decorators/storyTemplates';
import { storybookPackageName, DOCUMENTATION_URL, STORYBOOK_CATEGORY } from 'storybook/constants/siteConstants';
import { Slider } from './index';
import { Form, FormControl, ControlLabel, FormGroup, Col } from '../../index';
import { name } from '../../../package.json';

const SliderStories = storiesOf(
  `${storybookPackageName(name)}/${STORYBOOK_CATEGORY.FORMS_AND_CONTROLS}/Slider`,
  module
);

SliderStories.addDecorator(withKnobs);
SliderStories.addDecorator(
  defaultTemplate({
    title: 'Slider',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_FORMS}slider`
  })
);

SliderStories.addWithInfo('Slider', () => (
  <div>
    <p>
      The component uses the Bootstrap-slider library, for more reading and available props please visit:
      <a href="https://github.com/seiyria/bootstrap-slider">&nbsp;https://github.com/seiyria/bootstrap-slider</a>
    </p>
    <br>
    <br>

    <div>
      </div></div>
github patternfly / patternfly-react / packages / patternfly-3 / patternfly-react / src / components / Slider / Slider.stories.js View on Github external
import { withKnobs } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';
import { defaultTemplate } from 'storybook/decorators/storyTemplates';
import { storybookPackageName, DOCUMENTATION_URL, STORYBOOK_CATEGORY } from 'storybook/constants/siteConstants';
import { Slider } from './index';
import { Form, FormControl, ControlLabel, FormGroup, Col } from '../../index';
import { name } from '../../../package.json';

const SliderStories = storiesOf(
  `${storybookPackageName(name)}/${STORYBOOK_CATEGORY.FORMS_AND_CONTROLS}/Slider`,
  module
);

SliderStories.addDecorator(withKnobs);
SliderStories.addDecorator(
  defaultTemplate({
    title: 'Slider',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_FORMS}slider`
  })
);

SliderStories.add('Slider', () =&gt; (
  <div>
    <p>
      The component uses the Bootstrap-slider library, for more reading and available props please visit:
      <a href="https://github.com/seiyria/bootstrap-slider">&nbsp;https://github.com/seiyria/bootstrap-slider</a>
    </p>
    <br>
    <br>

    <div>
      </div></div>
github patternfly / patternfly-react / packages / patternfly-3 / patternfly-react / src / components / Tabs / Tabs.stories.js View on Github external
import { defaultTemplate } from 'storybook/decorators/storyTemplates';
import { storybookPackageName, DOCUMENTATION_URL, STORYBOOK_CATEGORY } from 'storybook/constants/siteConstants';
import { TabContainer, Nav, NavItem, NavDropdown, MenuItem, TabPane, TabContent } from '../../index';
import { name } from '../../../package.json';

const stories = storiesOf(`${storybookPackageName(name)}/${STORYBOOK_CATEGORY.WIDGETS}/Tabs`, module);
const description = (
  <p>
    This component is based on React Bootstrap Tabs component. See{' '}
    <a href="{`${DOCUMENTATION_URL.REACT_BOOTSTRAP_COMPONENT}tabs/`}">React Bootstrap Docs</a> for complete Tabs component
    documentation.
  </p>
);
stories.addDecorator(withKnobs);
stories.addDecorator(
  defaultTemplate({
    title: 'Tabs',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_WIDGETS}#tabs`,
    description
  })
);

stories.add(
  'Basic Tabs',
  withInfo()(() =&gt; {
    const bsClass = classNames('nav nav-tabs', {
      'nav-justified': boolean('Justified', false)
    });
    const t1Disabled = boolean('Tab 1 Disabled', false);
    const t1Title = (
github patternfly / patternfly-react / packages / patternfly-react / src / components / MenuItem / MenuItem.stories.js View on Github external
import { defaultTemplate } from 'storybook/decorators/storyTemplates';
import { storybookPackageName, DOCUMENTATION_URL, STORYBOOK_CATEGORY } from 'storybook/constants/siteConstants';

const stories = storiesOf(`${storybookPackageName(name)}/${STORYBOOK_CATEGORY.WIDGETS}/Menu Item`, module);

const description = (
  <p>
    This component is based on React Bootstrap MenuItem component. This component represents a menu item in a dropdown.
    See <a href="{`${DOCUMENTATION_URL.REACT_BOOTSTRAP_COMPONENT}dropdowns/#menu-items`}">React Bootstrap Docs</a> for
    complete MenuItem component documentation.
  </p>
);

stories.addDecorator(
  defaultTemplate({
    title: 'MenuItem',
    description
  })
);

stories.add(
  'MenuItem',
  withInfo()(() =&gt; (
    <div>
      
        <menuitem>Header</menuitem>
        <menuitem>link</menuitem>
        <menuitem>
        <menuitem>Header</menuitem>
        <menuitem>link</menuitem>
        <menuitem disabled="">disabled</menuitem></menuitem></div>
github patternfly / patternfly-react / packages / core / src / components / Toolbar / Toolbar.stories.js View on Github external
import {
  MockToolbarExample,
  mockToolbarExampleSource
} from './__mocks__/mockToolbarExample';
import { name } from '../../../package.json';

const stories = storiesOf(
  `${storybookPackageName(name)}/${
    STORYBOOK_CATEGORY.FORMS_AND_CONTROLS
  }/Toolbar`,
  module
);

stories.addDecorator(
  defaultTemplate({
    title: 'Toolbar',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_FORMS}toolbar/`
  })
);

stories.add(
  'Toolbar',
  withInfo({
    source: false,
    propTables: [
      Toolbar,
      ToolbarResults,
      ToolbarRightContent,
      ToolbarFind,
      ToolbarViewSelector
    ],
github patternfly / patternfly-react / packages / core / src / components / Popover / Popover.stories.js View on Github external
import { defaultTemplate } from 'storybook/decorators/storyTemplates';
import {
  storybookPackageName,
  DOCUMENTATION_URL,
  STORYBOOK_CATEGORY
} from 'storybook/constants/siteConstants';
import { Button, OverlayTrigger, Popover } from '../../index';
import { name } from '../../../package.json';

const stories = storiesOf(
  `${storybookPackageName(name)}/${STORYBOOK_CATEGORY.WIDGETS}/Popover`,
  module
);
stories.addDecorator(withKnobs);
stories.addDecorator(
  defaultTemplate({
    title: 'Popover',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_WIDGETS}#popover`,
    reactBootstrapDocumentationLink: `${
      DOCUMENTATION_URL.REACT_BOOTSTRAP_COMPONENT
    }popovers/`
  })
);

stories.add(
  'Popover',
  withInfo()(() =&gt; {
    const title = (
      <div>
    );</div>
github patternfly / patternfly-react / packages / core / src / components / Slider / Slider.stories.js View on Github external
STORYBOOK_CATEGORY
} from 'storybook/constants/siteConstants';
import { Slider } from './index';
import { Form, FormControl, ControlLabel, FormGroup, Col } from '../../index';
import { name } from '../../../package.json';

const SliderStories = storiesOf(
  `${storybookPackageName(name)}/${
    STORYBOOK_CATEGORY.FORMS_AND_CONTROLS
  }/Slider`,
  module
);

SliderStories.addDecorator(withKnobs);
SliderStories.addDecorator(
  defaultTemplate({
    title: 'Slider',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_FORMS}slider`
  })
);

SliderStories.addWithInfo('Slider', () =&gt; (
  <div>
    <p>
      The component uses the Bootstrap-slider library, for more reading and
      available props please visit:
      <a href="https://github.com/seiyria/bootstrap-slider">
        &nbsp;https://github.com/seiyria/bootstrap-slider
      </a>
    </p>
    <br>
    <br></div>
github patternfly / patternfly-react / packages / core / src / components / Spinner / Spinner.stories.js View on Github external
import {
  storybookPackageName,
  DOCUMENTATION_URL,
  STORYBOOK_CATEGORY
} from 'storybook/constants/siteConstants';
import { Spinner } from './index';
import { name } from '../../../package.json';

const stories = storiesOf(
  `${storybookPackageName(name)}/${STORYBOOK_CATEGORY.WIDGETS}/Spinner`,
  module
);

stories.addDecorator(withKnobs);
stories.addDecorator(
  defaultTemplate({
    title: 'Spinner',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_WIDGETS}#spinner`
  })
);

stories.add(
  'Spinner',
  withInfo()(() => {
    const loading = boolean('Loading', true);
    const inline = boolean('Inline', false);
    const inverse = boolean('Inverse', false);
    const size = select('Size', ['lg', 'md', 'sm', 'xs'], 'md');
    const wrapperStyle = {
      backgroundColor: inverse ? 'black' : 'white',
      color: inverse ? 'white' : 'black',
      padding: '15px'
github patternfly / patternfly-react / packages / patternfly-3 / patternfly-react / src / components / LoginPage / LoginPage.stories.js View on Github external
getManagedPageWithErrorsOnTopProps,
  getManagedPageProps,
  getBuildYourOwnPageProps,
  createLogoList,
  getManagedSocialLoginPageProps,
  getBuildYourOwnSocialLoginPageProps
} from './LoginPageFixtures';

const stories = storiesOf(
  `${storybookPackageName(name)}/${STORYBOOK_CATEGORY.APPLICATION_FRAMEWORK}/Login Page`,
  module
);

stories.addDecorator(withKnobs);
stories.addDecorator(
  defaultTemplate({
    title: 'Login Page',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_APP_FRAMEWORK}login-page`
  })
);

stories.add('Managed Login Page with errors display on top of the form', () =&gt; (
  
));

stories.add('Managed Login Page with errors display under form inputs', () =&gt; );

stories.add('Build Your own Basic Login Page', () =&gt; LoginPage.Pattern(getBuildYourOwnPageProps()));

stories.add('Managed Social Login Page', () =&gt; {
  const logoListCopy = createLogoList();
  const listSize = number('Social List Size', 12);
github patternfly / patternfly-react / packages / patternfly-react / src / components / ListGroup / ListGroup.stories.js View on Github external
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withInfo } from '@storybook/addon-info';
import { defaultTemplate } from 'storybook/decorators/storyTemplates';
import { storybookPackageName, DOCUMENTATION_URL, STORYBOOK_CATEGORY } from 'storybook/constants/siteConstants';
import { Badge } from '../Badge';
import { ListGroup, ListGroupItem } from './index';
import { name } from '../../../package.json';

const stories = storiesOf(`${storybookPackageName(name)}/${STORYBOOK_CATEGORY.WIDGETS}/List Group`, module);

stories.addDecorator(
  defaultTemplate({
    title: 'ListGroup',
    documentationLink: `${DOCUMENTATION_URL.PATTERNFLY_ORG_WIDGETS}#list-group`,
    reactBootstrapDocumentationLink: `${DOCUMENTATION_URL.REACT_BOOTSTRAP_COMPONENT}list-group/`
  })
);

stories.add(
  'List Group',
  withInfo()(() =&gt; (
    <div>
      <h2>Basic</h2>
      
        Cras justo odio
        Dapibus ac facilisis in
        Morbi leo risus
        Porta ac consectetur ac</div>