Skip to content

Commit

Permalink
improve template
Browse files Browse the repository at this point in the history
  • Loading branch information
morewings committed Dec 18, 2023
1 parent d1e12cb commit 8c770f8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,15 @@ module.exports = {
],
},
},
/**
* Disable rules of hooks for story files in order to have better story code display.
* @see TemplateName.stories.tsx
*/
{
files: ['**/*.stories.*'],
rules: {
'react-hooks/rules-of-hooks': 'off',
},
},
],
};
25 changes: 23 additions & 2 deletions templates/Component/TemplateName.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,28 @@ export default meta;
type Story = StoryObj<typeof meta>;

export const Primary: Story = {
args: {
initialValue: 0,
render: args => {
return <TemplateName {...args} />;
},
args: {},
};

export const WithCode: Story = {
render: args => {
// here comes the code
return <TemplateName {...args} />;
},
};

WithCode.args = {};

WithCode.argTypes = {};

WithCode.parameters = {
docs: {
source: {
language: 'tsx',
type: 'code',
},
},
};

0 comments on commit 8c770f8

Please sign in to comment.