Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initialOpen as an option in sections from the config #1674

Closed
josephrexme opened this issue Sep 1, 2020 · 1 comment
Closed

initialOpen as an option in sections from the config #1674

josephrexme opened this issue Sep 1, 2020 · 1 comment

Comments

@josephrexme
Copy link
Contributor

josephrexme commented Sep 1, 2020

The problem
It will be great if the initialOpen option on this line is allowed to be passed from the styleguide.config with each section similar to sectionDepth.

As I was going to make a PR, I had thought simply removing it from that line will make the one I set in config available to use in the ComponentListRenderer but then I realized every custom options passed to our sections in the config aren't being sent all the way to ComponentsList here.

I understand if we don't want to make initialOpen available at the config level for some reasons but I would like to implement this effect myself of having specific sections in toc expanded and I can't do that if I don't get my custom parameters. Here's me trying to use expand:

module.exports = {
  sections: [
    {
      name: 'Components',
      content: 'docs/ui.md',
      components: 'components/**/index.js',
      exampleMode: 'collapse',
      usageMode: 'expand',
      expanded: true, // need access to this
      sectionDepth: 1,
    }
  ]
}

Proposed solution

Make initialOpen set per section from the config and do not override but instead provide defaults for when user didn't set

Alternative solutions

Passing all user options at config and always making them available for developers writing custom styleguide render files

@josephrexme
Copy link
Contributor Author

Made a PR at #1689

@sapegin sapegin closed this as completed Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants