diff --git a/packages/react/.storybook/preview.cjs b/packages/react/.storybook/preview.cjs deleted file mode 100644 index 48afd56..0000000 --- a/packages/react/.storybook/preview.cjs +++ /dev/null @@ -1,9 +0,0 @@ -export const parameters = { - actions: { argTypesRegex: "^on[A-Z].*" }, - controls: { - matchers: { - color: /(background|color)$/i, - date: /Date$/, - }, - }, -} \ No newline at end of file diff --git a/packages/react/.storybook/preview.js b/packages/react/.storybook/preview.js new file mode 100644 index 0000000..3b8bb42 --- /dev/null +++ b/packages/react/.storybook/preview.js @@ -0,0 +1,24 @@ +export const parameters = { + actions: { argTypesRegex: "^on[A-Z].*" }, + controls: { + matchers: { + color: /(background|color)$/i, + date: /Date$/, + }, + }, + options: { + storySort: (a, b) => { + const roots = ['Getting Started', 'Components']; + + const aParts = a.title.split('/'); + const bParts = b.title.split('/'); + if (aParts[0] !== bParts[0]) { + return roots.indexOf(aParts[0]) - roots.indexOf(bParts[0]); + } + if (aParts[1] !== bParts[1]) { + return aParts[1].localeCompare(bParts[1]); + } + return 0; + } + } +} \ No newline at end of file