Giter Site home page Giter Site logo

sm-react / storybook-chapters Goto Github PK

View Code? Open in Web Editor NEW
46.0 5.0 7.0 4.5 MB

React Storybook Addon for Hierarchical Substories (Chapters)

Home Page: https://sm-react.github.io/storybook-chapters

License: MIT License

JavaScript 96.45% HTML 2.51% CSS 1.04%
react react-storybook addon chapters hierarchy add-subchapters navigation storybook-chapters

storybook-chapters's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

storybook-chapters's Issues

Can this lib support @storybook/react-native?

I use @storybook/react-native for a React Native project, and I did not install @storybook/react.

After install and run storybook-chapters, it shows:

error: bundling: UnableToResolveError: Unable to resolve module `@storybook/react` from `{path_to_project}/node_modules/@storybook/addon-chapters/dist/index.js`: 
Module does not exist in the module map or in these directories:
  {path_to_project}/node_modules/@storybook/addon-chapters/node_modules/@storybook
,  {path_to_project}/node_modules/@storybook

Do I need to install @storybook/react? Does it support React Native app development?

Can't resolve '@storybook/addon-chapters/register'

After following the guideline in the README file, I added a line to addons.js:

import '@storybook/addon-chapters/register';

but when I ran storybook, it shows:

ERROR in ./storybook/addons.js
Module not found: Error: Can't resolve '@storybook/addon-chapters/register' in '{path_to_project}/storybook'
 @ ./storybook/addons.js 1:0-45
 @ multi ./storybook/addons.js ./~/@storybook/react-native/dist/manager/index.js

I check this repo and I find the register.js file in the ./dist/register.js not ./register.js.

API for declaring chapters

In your readme you've documented this as the API for adding chapters:

// stories.js:

storiesOf('React App', module)
    .chapter('Left panel')
        .add('Button 1', fn(1))
        .add('Button 2', fn(2))
        .chapter('Bottom Panel')
            .add('Input 3', fn(3))
            .add('Input 4', fn(4))
            .endOfChapter()
        .chapter('Header Panel')
            .add('Input 5', fn(5))
            .add('Input 6', fn(6))
            .endOfChapter()
        .endOfChapter()
    .chapter('Right panel')
        .add('Button 7', fn(7))
        .add('Button 8', fn(8))
        .endOfChapter()

I wonder how much effort it would take to change this into:

// stories.js:

storiesOf('React App', module)
    .chapter('Left panel', chapter => chapter
        .add('Button 1', fn(1))
        .add('Button 2', fn(2))
        .chapter('Bottom Panel', chapter => chapter
            .add('Input 3', fn(3))
            .add('Input 4', fn(4))
        )
    )
    .chapter('Header Panel', chapter => chapter
        .add('Input 5', fn(5))
        .add('Input 6', fn(6))
    )
    .chapter('Right panel' chapter => chapter
        .add('Button 7', fn(7))
        .add('Button 8', fn(8))
    )

No more need for .endOfChapter() and code indenting-wise it's more correct.

URL Routing not working

Actual behaviour:
Given I opened a story
When I refresh the page
Then I am at the root of the storybook

Expected behaviour:
Given I opened a story
When I refresh the page
Then the story is still open

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.