prantlf / storybook-multilevel-sort

Applies specific sort order to more than two levels of chapters and stories in Storybook.
https://storybook.js.org/addons/storybook-multilevel-sort/
Other
8 stars 4 forks source link

Adding camelizing of story names #4

Open dm-camelonta opened 1 year ago

dm-camelonta commented 1 year ago

Stories with multiple words didn't work. I added a camelizing function to use instead of just toLower to support that.

Story example that didn't work previous to camelizing: export const WithIcon = Template.bind({});

prantlf commented 1 year ago

Yes, that would be an alternative how to handle stories using names made of multiple words. But is it not easier to just use the name of the story as-is? You use the same text that you see in the storybook, just in lower-case.

Storybook passes the displayable names of the stories to the sorting method. Not the exported variable name in camel-case, but the displayable name with spaces. What advantage does it have to convert the displayable name back to camel case? It would need an extra code.

So, the story named like this:

export const WithIcon = Template.bind({});

Can be currently placed at a particular position like this:

const order = {
  '*': {
    'with icon': null
  }
}

What do you think?