-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Use Storybook
args
(first round) (#35915)
Partial for #35923 This is the first step to replace Storybook Knobs (deprecated)[1] with Controls[2]. [1] https://www.npmjs.com/package/@storybook/addon-knobs [2] https://storybook.js.org/docs/react/essentials/controls We have over 60 Storybook files. I'm submitting the PRs in multiple rounds to prevent overwhelming the reviewers. In summary: 1. Installs `@storybook/addon-controls` 2. Updates template for generated Stories. 3. Updates 15 Stories across extensions.
- Loading branch information
1 parent
a9a4663
commit 64cb73b
Showing
21 changed files
with
730 additions
and
615 deletions.
There are no files selected for viewing
11 changes: 6 additions & 5 deletions
11
...nto/extensions/amp-__component_name_hyphenated__/__component_version__/storybook/Basic.js
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
15 changes: 6 additions & 9 deletions
15
...extensions/amp-__component_name_hyphenated__/__component_version__/storybook/Basic.amp.js
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,32 +1,29 @@ | ||
import * as Preact from '#preact'; | ||
import {withAmp} from '@ampproject/storybook-addon'; | ||
import {withKnobs} from '@storybook/addon-knobs'; | ||
|
||
export default { | ||
title: 'amp-__component_name_hyphenated__-__component_version_snakecase__', | ||
decorators: [withKnobs, withAmp], | ||
|
||
decorators: [withAmp], | ||
parameters: { | ||
extensions: [ | ||
{name: 'amp-__component_name_hyphenated__', version: '__component_version__'}, | ||
], | ||
__storybook_experiments_do_not_add_trailing_comma__ | ||
}, | ||
args: { | ||
'data-example-property': 'example string property argument' | ||
} | ||
}; | ||
|
||
// __do_not_submit__: This is example code only. | ||
export const ExampleUseCase = () => { | ||
export const _default = (args) => { | ||
return ( | ||
<amp-__component_name_hyphenated__ | ||
width="300" | ||
height="200" | ||
example-property="example string property value" | ||
{...args} | ||
> | ||
This text is inside. | ||
</amp-__component_name_hyphenated__> | ||
); | ||
}; | ||
|
||
ExampleUseCase.story = { | ||
name: 'Example use case story' | ||
}; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.