Skip to content

Commit

Permalink
docs: sort test stories to bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
alampros committed Apr 3, 2019
1 parent 00a8599 commit aea30c1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ addParameters({

const req = require.context('../stories', true, /\.stor(y|ies)\.jsx?$/)
function loadStories() {
req.keys().forEach(filename => req(filename))
req.keys()
.sort((a, b) => {
if(a.includes('test.') && b.includes('test.')) return 0
if(a.includes('test.') && !b.includes('test.')) return 1
if(!a.includes('test.') && b.includes('test.')) return -1
return a.localeCompare(b)
})
.forEach(filename => req(filename))
}

configure(loadStories, module)

0 comments on commit aea30c1

Please sign in to comment.