-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37818 from VickyStash/ts-migration/g13-stories
[TS migration] Migrate 'Checkbox.stories.js', 'FormAlertWithSubmitButton.stories.js', 'Header.stories.js' and 'HeaderWithBackButton.stories.js' stories to TypeScript
- Loading branch information
Showing
7 changed files
with
43 additions
and
23 deletions.
There are no files selected for viewing
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
13 changes: 9 additions & 4 deletions
13
src/stories/Checkbox.stories.js → src/stories/Checkbox.stories.tsx
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,28 +1,33 @@ | ||
import type {ComponentMeta, ComponentStory} from '@storybook/react'; | ||
import React from 'react'; | ||
import Checkbox from '@components/Checkbox'; | ||
import type {CheckboxProps} from '@components/Checkbox'; | ||
|
||
type CheckboxStory = ComponentStory<typeof Checkbox>; | ||
|
||
/** | ||
* We use the Component Story Format for writing stories. Follow the docs here: | ||
* | ||
* https://storybook.js.org/docs/react/writing-stories/introduction#component-story-format | ||
*/ | ||
export default { | ||
const story: ComponentMeta<typeof Checkbox> = { | ||
title: 'Components/Checkbox', | ||
component: Checkbox, | ||
}; | ||
|
||
function Template(args) { | ||
function Template(props: CheckboxProps) { | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
return <Checkbox {...args} />; | ||
return <Checkbox {...props} />; | ||
} | ||
|
||
// Arguments can be passed to the component by binding | ||
// See: https://storybook.js.org/docs/react/writing-stories/introduction#using-args | ||
const Default = Template.bind({}); | ||
const Default: CheckboxStory = Template.bind({}); | ||
Default.args = { | ||
onPress: () => {}, | ||
isChecked: true, | ||
accessibilityLabel: '', | ||
}; | ||
|
||
export default story; | ||
export {Default}; |
19 changes: 10 additions & 9 deletions
19
...ries/FormAlertWithSubmitButton.stories.js → ...ies/FormAlertWithSubmitButton.stories.tsx
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
12 changes: 8 additions & 4 deletions
12
src/stories/Header.stories.js → src/stories/Header.stories.tsx
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
16 changes: 10 additions & 6 deletions
16
src/stories/HeaderWithBackButton.stories.js → src/stories/HeaderWithBackButton.stories.tsx
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