Skip to content

Commit

Permalink
feat(redmine 1258410): add Code.mdx template and updating config file…
Browse files Browse the repository at this point in the history
… for generation of turbo
  • Loading branch information
vapersmile committed Oct 18, 2023
1 parent 4bbdcf4 commit daed6bc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
2 changes: 0 additions & 2 deletions packages/react-front-kit/src/Pages/DocumentDetails/Code.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{/* Checkbox.mdx */}

import { Meta, Source } from '@storybook/blocks';

import * as DocumentDetailsStory from './DocumentDetails.stories';
Expand Down
2 changes: 0 additions & 2 deletions packages/react-front-kit/src/Pages/TestPage/Code.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{/* Checkbox.mdx */}

import { Meta, Source } from '@storybook/blocks';

import * as TestPageStory from './TestPage.stories';
Expand Down
6 changes: 6 additions & 0 deletions packages/react-front-kit/turbo/generators/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
templateFile: 'templates/test.hbs',
type: 'add',
});
} else {
actions.push({
path: 'src/{{path}}/{{pascalCase name}}/Code.mdx',
templateFile: 'templates/pageCode.hbs',
type: 'add',
});
}
if (data?.index) {
actions.push({
Expand Down
13 changes: 13 additions & 0 deletions packages/react-front-kit/turbo/generators/templates/pageCode.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Meta, Source } from '@storybook/blocks';

import * as {{pascalCase name}}Story from './{{pascalCase name}}.stories';

import {{pascalCase name}} from './{{pascalCase name}}?raw';

<Meta of={ {{pascalCase name}}Story} />

# Code

Code of {{pascalCase name}} page

<Source code={`${ {{pascalCase name}} }`} />
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const meta = {
parameters: {
layout: 'fullscreen',
},
title: '{{path}}/{{pascalCase name}}',
title: '3-custom/Pages/{{pascalCase name}}',
} satisfies Meta<typeof Cmp>;

export default meta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { {{pascalCase name}} as Cmp } from './{{pascalCase name}}';
const meta = {
component: Cmp,
tags: ['autodocs'],
title: '{{path}}/{{pascalCase name}}',
title: '3-Custom/{{path}}/{{pascalCase name}}',
} satisfies Meta<typeof Cmp>;

export default meta;
Expand Down

0 comments on commit daed6bc

Please sign in to comment.