How to use the @storybook/riot.storiesOf function in @storybook/riot

To help you get started, we’ve selected a few @storybook/riot 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 storybookjs / storybook / lib / cli / generators / RIOT / template / stories / index.stories.js View on Github external
import { mount, storiesOf } from '@storybook/riot';
import { linkTo } from '@storybook/addon-links';

/* eslint-disable-next-line import/no-webpack-loader-syntax */
import MyButtonRaw from 'raw-loader!./MyButton.tag';
import './MyButton.tag';
import './Welcome.tag';

storiesOf('Welcome', module).add('to Storybook', () =>
  mount('welcome', { showApp: () => linkTo('Button') })
);

storiesOf('Button', module)
  .add('with text', () => ({
    tags: ['Hello Button'],
  }))
  .add('with scenario', () => ({
    tags: [{ content: MyButtonRaw, boundAs: 'MyButton' }],
    template: 'With scenario',
  }))
  .add('with some emoji', () => ({
    tags: ['😀 😎 👍 💯'],
  }));
github storybookjs / storybook / examples / riot-kitchen-sink / src / stories / index.js View on Github external
import { mount, storiesOf } from '@storybook/riot';
import { linkTo } from '@storybook/addon-links';
import ButtonRaw from './Button.txt';
import './Welcome.tag';
import '../App.tag';

storiesOf('Welcome', module).add('Welcome', () =>
  mount('welcome', { goToButton: linkTo('Button') })
);

storiesOf('App', module).add('App', () => mount('app', {}));

storiesOf('Button', module)
  // Works if riot.component is called in the config.js in .storybook
  .add('rounded', () => ({
    tags: [{ boundAs: 'my-button', content: ButtonRaw }],
    template: 'A Button with rounded edges',
  }))
  .add('square', () => ({
    tags: [{ boundAs: 'my-button', content: ButtonRaw }],
    template: 'A Button with square edges',
  }));
github storybookjs / storybook / examples / riot-kitchen-sink / src / stories / index.js View on Github external
import { mount, storiesOf } from '@storybook/riot';
import { linkTo } from '@storybook/addon-links';
import ButtonRaw from './Button.txt';
import './Welcome.tag';
import '../App.tag';

storiesOf('Welcome', module).add('Welcome', () =>
  mount('welcome', { goToButton: linkTo('Button') })
);

storiesOf('App', module).add('App', () => mount('app', {}));

storiesOf('Button', module)
  // Works if riot.component is called in the config.js in .storybook
  .add('rounded', () => ({
    tags: [{ boundAs: 'my-button', content: ButtonRaw }],
    template: 'A Button with rounded edges',
  }))
  .add('square', () => ({
    tags: [{ boundAs: 'my-button', content: ButtonRaw }],
    template: 'A Button with square edges',
  }));
github storybookjs / storybook / lib / cli / generators / RIOT / template / stories / index.stories.js View on Github external
import { mount, storiesOf } from '@storybook/riot';
import { linkTo } from '@storybook/addon-links';

/* eslint-disable-next-line import/no-webpack-loader-syntax */
import MyButtonRaw from 'raw-loader!./MyButton.tag';
import './MyButton.tag';
import './Welcome.tag';

storiesOf('Welcome', module).add('to Storybook', () =>
  mount('welcome', { showApp: () => linkTo('Button') })
);

storiesOf('Button', module)
  .add('with text', () => ({
    tags: ['Hello Button'],
  }))
  .add('with scenario', () => ({
    tags: [{ content: MyButtonRaw, boundAs: 'MyButton' }],
    template: 'With scenario',
  }))
  .add('with some emoji', () => ({
    tags: ['😀 😎 👍 💯'],
  }));
github storybookjs / storybook / examples / riot-kitchen-sink / src / stories / story-code.stories.js View on Github external
import { tag, mount, storiesOf, asCompiledCode } from '@storybook/riot';
import SimpleTestRaw from './SimpleTest.txt';
import './AnotherTest.tag';

const simpleTestCompiled = asCompiledCode(SimpleTestRaw);

storiesOf('Story|How to create a story', module)
  .add(
    'built with tag',
    () =>
      tag('test', '<div>simple test ({ opts.value })</div>', '', '', () =&gt; {}) &amp;&amp;
      mount('test', { value: 'with a parameter' })
  )

  .add('built as string', () =&gt; ({ tags: ['<div>simple test</div>'] }))

  .add('built from raw import', () =&gt; simpleTestCompiled)

  .add(
    'built from tags and template',
    () =&gt; ({
      tags: [{ content: SimpleTestRaw, boundAs: 'mustBeUniquePlease' }],
      template:
github storybookjs / storybook / examples / riot-kitchen-sink / src / stories / story-code.stories.js View on Github external
template:
      '',
    tagConstructor: function tagConstructor() {
      this.hacked = true;
    },
  }))

  .add('built from the precompilation', () =&gt; mount('anothertest', {}), {
    notes: 'WARN, only works in lower case, never upper case with precompiled templates',
  })

  .add('the mount instruction is not necessary', () =&gt; ({ tagName: 'anothertest', opts: {} }))

  .add('the opts value is not necessary', () =&gt; ({ tagName: 'anothertest' }));

storiesOf('Story|Nest tags', module)
  .add('Three tags', () =&gt; ({
    tags: [
      'Simple titleSimple Content',
      '<h1></h1>',
      '<div style="border-radius: 1em;border-right: solid 1px #cac9c9;border-bottom: solid 1px #cac9c9;box-shadow: 1em 1em 2em #eae9e9; margin: 3em; padding: 3em;min-height: 10em;min-width: 30em"></div>',
    ],
  }))

  .add('Matriochka', () =&gt; ({
    tags: [
      '<div>Inside tag1:<ul><li></li></ul></div>',
      '<div>Inside tag2:<ul><li></li></ul></div>',
      '<div>Inside tag3:<ul><li></li></ul></div>',
      '<div>Inside tag4:<ul><li></li></ul></div>',
      '<div>Inside tag5:<ul><li></li></ul></div>',
    ],

@storybook/riot

Storybook for riot.js: View riot snippets in isolation with Hot Reloading.

MIT
Latest version published 4 years ago

Package Health Score

64 / 100
Full package analysis