-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Allow storySort
to sort nested stories below generic parent
#16573
Comments
storySort
to sort nested storiesstorySort
to sort nested stories below generic parent
Hello, I am also interested to help on this issue |
Hey, has there been any progress on this issue? Would be nice to have it :) |
I'd like this to happen too! One workaround that works for me is when you export stories, name the one you'd like to show first in capital letter first, whereas the rest in lowercase first.
would make it show in this order: |
+1 Would really like this feature |
I got nested sorting to work by setting
|
@suchali93 can you confirm that this approach works as well if you e.g. swapped |
I've added a PR to add that wildcard. Anyone have feedback on it? :) |
I tested this fix on my project and it's working for me. I have this order {
storySort: {
includeNames: true,
order: [
'Phoenix-UI-Layouts',
'Phoenix-UI-Atoms',
'Phoenix-UI-Components',
['*', ['Overview', 'Parameters']],
'*',
'Legacy',
],
},
}, |
Olé!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-alpha.7 containing PR #18243 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
It worked for me |
Is your feature request related to a problem? Please describe
We maintain a component library where we want to sort all nested stories of
Components
(e.g.Components/Button
) in the same order. Here's an example structure:And here's what you would pass to
options.storySort
:Here the order for each section of
Components/*
must be defined separately.Describe the solution you'd like
Given there already is a special
*
operator we thought we might declare the order as follows:Which would basically sort all children of
Components
with whats specified bymethod
and apply the custom order to the next level. But as you might imagine from this issue this does not work out of the box.Describe alternatives you've considered
For now we copied contents of
storySort.ts
and adjusted line 82 by adding special treatment for*
:Are you able to assist to bring the feature to reality?
yes, I'd be glad to help
Additional context
A similar problem was described before here by @brandondurham:
https://stackoverflow.com/questions/68838338/sorting-in-storybook-possible-to-force-an-order-for-nested-stories
I've seen there's some shuffling around on the next branch, so I'm not able to tell whether sorting will work the same as right now in
v6
. But let me know what you think and maybe this valuable input for future versions as well :)The text was updated successfully, but these errors were encountered: