Skip to content

initialOpen as an option in sections from the config #1674

@josephrexme

Description

@josephrexme

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions