Files
cunningham/packages/react/.storybook/preview.js
Nathan Vasse cd88e46537 ♻️(react) split fonts in a seperate CSS file
Fonts were de-facto included in the bundled dist/style.css file which
wasn't convenient in situations were consumers wanted to import fonts
by themselves.
2023-02-21 09:29:24 +01:00

31 lines
884 B
JavaScript

import '../src/index.scss'
import '../src/fonts.scss'
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 gettingStartedOrder = ['Installation', 'Colors', 'Spacings', 'Typography'];
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]) {
if (aParts[0] === 'Getting Started') {
return gettingStartedOrder.indexOf(aParts[1]) - gettingStartedOrder.indexOf(bParts[1]);
}
return aParts[1].localeCompare(bParts[1]);
}
return 0;
}
}
}