@latticejs/storybook-readme

1.0.1-beta.1 • Public • Published

@latticejs/storybook-readme

Private set of storybook readme addon helpers to be used within @latticejs packages.

Api

withReadme

function(readme: String) => (function(sections: Array)) Adds a Readme section tab for your Storybook.

Returns another function to be used as storybook HOC that injects some sections (joined) from readme passed as argument. See Usage for more info.

You must include the tags <!-- start:section_name --> and <!-- end:section_name --> to indicate the start and the end of your readme section to be included.

Usage

withReadme

To load some sections of your readme:

import { withReadme } from '@latticejs/storybook-readme';
import Readme from 'path/to/your/README.md';

const loadSections = withReadme(Readme);
const withSomeReadmeSections = loadSections(['api', 'usage']);

export default ({ storiesOf }) => {
  storiesOf('components', module)
    .add(
      'basic',
      withSomeReadmeSections(() => (
        <Basic />
      ))
    );
};

To load all the content of Readme:

import { withReadme } from '@latticejs/storybook-readme';
import Readme from 'path/to/your/README.md';

const withAllReadme = withReadme(Readme);

export default ({ storiesOf }) => {
  storiesOf('components', module)
    .add(
      'basic',
      withAllReadme(() => (
        <Basic />
      ))
    );
};

Readme

Keywords

none

Package Sidebar

Install

npm i @latticejs/storybook-readme

Weekly Downloads

2

Version

1.0.1-beta.1

License

MIT

Unpacked Size

6.4 kB

Total Files

6

Last publish

Collaborators

  • clinejm
  • rahulgarg30591