Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 1x 6x 6x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 6x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 6x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 6x 6x 1x 1x 1x | import {capitalize, checkSubject, type PrimitiveDescriptor} from '../engine.ts';
/** `storybook` — Storybook config and stories built on the shared factories. */
const storybook: PrimitiveDescriptor = {
id: 'storybook',
title: 'Storybook',
skill: 'storybook-v10-setup',
summary: 'Storybook config and stories using the shared blong factories/decorators.',
kinds: ['main', 'preview', 'story'],
defaultKind: 'story',
roots: ['.storybook', 'src/stories'],
check(ctx) {
return checkSubject(ctx.subject);
},
files(ctx) {
switch (ctx.kind) {
case 'main':
return [
{
path: '.storybook/main.ts',
content: `import {defineBlongStorybookMain} from '@feasibleone/blong-browser/storybookMain';
export default defineBlongStorybookMain({
stories: ['../src/**/*.stories.@(ts|tsx)'],
});
`,
},
];
case 'preview':
return [
{
path: '.storybook/preview.tsx',
content: `import {withBlong} from '@feasibleone/blong-browser/storyHelper';
import type {Preview} from '@storybook/react';
const preview: Preview = {
decorators: [withBlong()],
};
export default preview;
`,
},
];
default:
return [
{
path: `src/stories/${capitalize(ctx.object)}.stories.tsx`,
content: `import type {Story} from '@storybook/react';
import {${capitalize(ctx.object)}} from '../components/${capitalize(ctx.object)}';
export default {title: '${ctx.subject}/${capitalize(ctx.object)}'};
export const Default: Story = {args: {}};
`,
},
];
}
},
};
export default storybook;
|