forked from redwoodjs/redwood
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(storybook): add
args
to auto generate docs
see: - storybookjs/storybook#8104 (comment) - https://storybook.js.org/docs/react/writing-docs/doc-block-source
- Loading branch information
1 parent
b562305
commit 951eb84
Showing
4 changed files
with
14 additions
and
14 deletions.
There are no files selected for viewing
16 changes: 8 additions & 8 deletions
16
packages/cli/src/commands/generate/cell/templates/stories.js.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { Loading, Empty, Failure, Success } from './${pascalName}Cell' | ||
import { standard } from './${pascalName}Cell.mock' | ||
|
||
export const loading = () => { | ||
return Loading ? <Loading /> : null | ||
export const loading = (args) => { | ||
return Loading ? <Loading {...args} /> : null | ||
} | ||
|
||
export const empty = () => { | ||
return Empty ? <Empty /> : null | ||
export const empty = (args) => { | ||
return Empty ? <Empty {...args} /> : null | ||
} | ||
|
||
export const failure = () => { | ||
return Failure ? <Failure error={new Error("Oh no")} /> : null | ||
export const failure = (args) => { | ||
return Failure ? <Failure error={new Error("Oh no")} {...args} /> : null | ||
} | ||
|
||
export const success = () => { | ||
return Success ? <Success {...standard()} /> : null | ||
export const success = (args) => { | ||
return Success ? <Success {...standard()} {...args} /> : null | ||
} | ||
|
||
export default { title: 'Cells/${pascalName}Cell' } |
4 changes: 2 additions & 2 deletions
4
packages/cli/src/commands/generate/component/templates/stories.tsx.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import ${pascalName} from './${pascalName}' | ||
|
||
export const generated = () => { | ||
return <${pascalName} /> | ||
export const generated = (args) => { | ||
return <${pascalName} {...args} /> | ||
} | ||
|
||
export default { title: 'Components/${pascalName}' } |
4 changes: 2 additions & 2 deletions
4
packages/cli/src/commands/generate/layout/templates/stories.tsx.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import ${singularPascalName}Layout from './${pascalName}Layout' | ||
|
||
export const generated = () => { | ||
return <${singularPascalName}Layout /> | ||
export const generated = (args) => { | ||
return <${singularPascalName}Layout {...args} /> | ||
} | ||
|
||
export default { title: 'Layouts/${singularPascalName}Layout' } |
4 changes: 2 additions & 2 deletions
4
packages/cli/src/commands/generate/page/templates/stories.tsx.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import ${pascalName}Page from './${pascalName}Page' | ||
|
||
export const generated = () => { | ||
return <${pascalName}Page ${propValueParam}/> | ||
export const generated = (args) => { | ||
return <${pascalName}Page ${propValueParam} {...args} /> | ||
} | ||
|
||
export default { title: 'Pages/${pascalName}Page' } |