Skip to content

Commit 44c9de5

Browse files
authored
Merge pull request #531 from catho/QTM-528
fix[QTM-528] Fixes Create a Component script
2 parents b5618f6 + 06a2c68 commit 44c9de5

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Diff for: CONTRIBUTING.MD

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Why _commitizen_? To enforce a padronization to the commits and make sure every
7373

7474
7. Update the live documentation (Storybook);
7575

76-
Every component must be on the dynamic documentation of the Storybook. For this reason, every behavior of the component must be documented and up to date within the files `stories/<nome do componente criado>.stories.jsx` and `stories/<nome do componente criado>.story.mdx`.
76+
Every component must be on the dynamic documentation of the Storybook. For this reason, every behavior of the component must be documented and up to date within the files `stories/<nome do componente criado>.stories.jsx` and `stories/<nome do componente criado>.mdx`.
7777

7878

7979
8. After making your changes in the new git branch, add your modified files to git, [How to add, commit, push and go](http://readwrite.com/2013/10/02/github-for-beginners-part-2/).
@@ -194,7 +194,7 @@ Follow steps [1 and 2](#getting-started) from Getting Started.
194194
195195
7. Update the live documentation (Storybook);
196196
197-
Each component must be on the dynamic documentation of the Storybook. Therefore, all the components' behaviors must be registered and updated in the files `stories/<name-of-the-edited-component>.stories.jsx` and `stories/<name-of-the-edited-component>.story.mdx`.
197+
Each component must be on the dynamic documentation of the Storybook. Therefore, all the components' behaviors must be registered and updated in the files `stories/<name-of-the-edited-component>.stories.jsx` and `stories/<name-of-the-edited-component>.mdx`.
198198

199199
8. Commit your changes using [commitizen](http://commitizen.github.io/cz-cli/);
200200

Diff for: scripts/templates/component-story.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = (componentName) => [
22
{
3-
content: `<!-- Generated with scripts/create-componnent.js -->
3+
content: `{/* Generated with scripts/create-componnent.js */}
44
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs';
55
import ${componentName} from '../../components/${componentName}';
66
@@ -26,14 +26,14 @@ import { ${componentName} } from '@catho/quantum';
2626
\`\`\`
2727
2828
<Canvas>
29-
<Story story={Default} />
29+
<Story of={Default} />
3030
</Canvas>
3131
3232
## <a id="api"></a>API
3333
3434
<ArgsTable of={${componentName}} />
3535
`,
36-
name: `${componentName}.story.mdx`,
36+
name: `${componentName}.mdx`,
3737
},
3838
{
3939
content: `// Generated with scripts/create-componnent.js
@@ -56,6 +56,11 @@ export const Default = Template.bind({})
5656
5757
import ${componentName} from '../../components/${componentName}';
5858
59+
export default {
60+
title: '${componentName}',
61+
component: ${componentName},
62+
};
63+
5964
const Template = args => <${componentName} {...args} />;
6065
6166
export const Default = Template.bind({})

Diff for: scripts/templates/component.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ export default ${componentName};
5050
{
5151
content: `
5252
// Generated with scripts/create-component.js
53-
import { Component } from 'react';
53+
import { FC } from 'react';
5454
5555
export interface ${componentName}Props {
5656
someProp?: string;
5757
}
5858
59-
export default class ${componentName} extends Component<${componentName}Props> {}
59+
60+
declare const ${componentName}: FC<${componentName}Props>;
61+
export default ${componentName}
6062
`,
6163
name: `index.d.ts`,
6264
},

0 commit comments

Comments
 (0)