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

Fallback sorting method configuration #3

Open
CoryDuncan opened this issue Aug 18, 2022 · 2 comments
Open

Fallback sorting method configuration #3

CoryDuncan opened this issue Aug 18, 2022 · 2 comments

Comments

@CoryDuncan
Copy link

CoryDuncan commented Aug 18, 2022

@prantlf Excellent package, thank you for this. It works well, I just had one question regarding to the "fallback sort":

Can be sorted according to this request:

  1. Elements before Components
  2. Default stories before the others
  3. Otherwise alphabetically

Is it possible to configure the fallback sort to be the order of stories defined in the file, matching the Storybook default, instead of alphabetically?

@prantlf
Copy link
Owner

prantlf commented Nov 27, 2022

Thanks for your kind words! I see what you mean. For example, being able to move a story to the beginning, but leaving the rest in the import order. Or ordering just the first-level groups explicitly, and leaving the stories in the import order.

It could be possible. The trick would be finding out the import order. It is not a parameter passed to te sorting method, though. I'll give it a thought, how to get or infer the import order.

@prantlf
Copy link
Owner

prantlf commented Nov 27, 2022

If you or somebody else wanted to give it a shot, I added support for custom comparators of group and story names in 1.2.0, which can check not only the two compared names, but also group paths, which lead to them. I would help, if the list of full story paths in the imported orders gets somehow available.

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