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

Core: Add renderLabel to customize sidebar tree labels #13121

Merged
merged 5 commits into from
Mar 1, 2021

Conversation

tooppaaa
Copy link
Contributor

@tooppaaa tooppaaa commented Nov 15, 2020

Issue: Lack of capability to add elements to

(Updated after @ghengeveld work)

sidebar subheadings (most important one in my opinion)
sidebar items
folder
component
story
This PR aims as a proposal for this and basis of discussions

image

Should we keep double icons when prefix is set ?
Should it be called prefix ?

@github-actions
Copy link
Contributor

github-actions bot commented Nov 15, 2020

Fails
🚫 PR is marked with "in progress" label.

Generated by 🚫 dangerJS against 3901ddc

@tooppaaa tooppaaa added core maintenance User-facing maintenance tasks labels Nov 15, 2020
@shilman shilman added feature request ui and removed maintenance User-facing maintenance tasks labels Nov 16, 2020
@ghengeveld ghengeveld self-assigned this Nov 18, 2020
@stale
Copy link

stale bot commented Dec 25, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Dec 25, 2020
@stale stale bot removed the inactive label Jan 6, 2021
@shilman
Copy link
Member

shilman commented Jan 6, 2021

cc @domyen @ghengeveld let's see what we can do to get this over the line

@wKich
Copy link
Member

wKich commented Jan 6, 2021

Yeah. It would be great to add prefix for items.

@saulmases
Copy link

I comment here because there is also interest in being able to customise storybook sidebar, like adding a prefix before the items so we can add there things like component status in the sidebar.

@wKich
Copy link
Member

wKich commented Jan 13, 2021

@tooppaaa, @shilman, can we also add a method to the client API that allows changing prefixes from code?

@tooppaaa
Copy link
Contributor Author

@wKich, that can be an interesting feature. I'd like to get this one merged before bringing more changes

@tooppaaa
Copy link
Contributor Author

@shilman merged next into this one.

@tooppaaa
Copy link
Contributor Author

@ghengeveld any update ?

@ghengeveld
Copy link
Member

Hey, I would like to propose the following:

  • We rename storyPrefix to sidebar in the config.
  • This accepts an object, with a storyLabel property (and potentially other sidebar config options, later down the road).
  • storyLabel is a function, which takes an Item (Root | Group | Story) and should return a string or ReactNode.
  • The default implementation would be item => item.name.

This would allow much more flexibility in terms of how the label is rendered in the sidebar.

@ghengeveld ghengeveld assigned tooppaaa and unassigned ghengeveld Feb 1, 2021
This was referenced Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants