Skip to content

Commit

Permalink
Add wildcard example to the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
randak committed Apr 9, 2021
1 parent 35521f5 commit b8ed01f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```js
// .storybook/preview.js

export const parameters = {
options: {
storySort: {
order: ['Intro', 'Pages', ['Home', 'Login', 'Admin'], 'Components', '*', 'WIP'],
},
},
};
```
14 changes: 14 additions & 0 deletions docs/writing-stories/naming-components-and-hierarchy.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,18 @@ Which would result in this story ordering:
7. `Components` and `Components/*` stories
8. All other stories

If you want certain categories to sort to the end of the list, you can insert a `*` into your `order` array to indicate where "all other stories" should go:

<!-- prettier-ignore-start -->

<CodeSnippets
paths={[
'common/storybook-preview-with-ordered-pages-and-wildcard.js.mdx',
]}
/>

<!-- prettier-ignore-end -->

In this example, the `WIP` category would be displayed at the end of the list.

Note that the `order` option is independent of the `method` option; stories are sorted first by the `order` array and then by either the `method: 'alphabetical'` or the default `configure()` import order.

0 comments on commit b8ed01f

Please sign in to comment.