-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add arg table for ReferenceArea stories #3486
Merged
ckifer
merged 2 commits into
recharts:master
from
lukask-proxora:3432-storybook-reference-area-args-table
Apr 7, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ArgTypes } from '@storybook/blocks'; | ||
import * as ReferenceAreaStories from './ReferenceArea.stories'; | ||
|
||
# ReferenceArea | ||
|
||
## Parent Component | ||
The ReferenceArea can be used within the following parent components: | ||
|
||
`<AreaChart/>` `<BarChart/>` `<LineChart/>` `<ComposedChart/>` `<ScatterChart/>` | ||
|
||
## Child component | ||
The ReferenceArea can be used with the following child components: `<Label/>` | ||
|
||
## Properties | ||
|
||
Properties in the groups Other and Internal are not recommended to be used. | ||
|
||
<ArgTypes of={ReferenceAreaStories} sort={'requiredFirst'}/> |
127 changes: 126 additions & 1 deletion
127
storybook/stories/API/cartesian/ReferenceArea.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* This file both exports the documentation of shared props separately, to be reused in places where only single props | ||
* are documented, as well as grouped in case a whole group is needed. | ||
*/ | ||
import { Args } from '@storybook/react'; | ||
|
||
export const radius = { | ||
description: | ||
'If set a value, the option is the radius of all the rounderd corners. If set a array, the option are in turn the radiuses of top-left corner, top-right corner, bottom-right corner, bottom-left corner.', | ||
table: { | ||
type: { summary: 'number | number[]' }, | ||
defaultValue: { summary: 0 }, | ||
category: 'Style', | ||
}, | ||
}; | ||
|
||
export const isUpdateAnimationActive = { | ||
description: 'If set false, animation of component updates will be disabled.', | ||
table: { category: 'Animation' }, | ||
}; | ||
|
||
/** | ||
* Caveat: If any prop is added here, it would falsely be add to the documentation of the component where this group | ||
* is used. If the group is to be extended, then only single props should be imported by each component that does not | ||
* use all of them. | ||
* */ | ||
export const RectangleProps: Args = { | ||
radius, | ||
isUpdateAnimationActive, | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the defaultValue seems to be defined twice. Is that necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nikolasrieble, without the
defaultValue
in thetable
prop, the default value in the args table is not set to the manually setdefaultValue
of the argType, but only to the inferred default value.According to storybookjs/storybook#11983 (comment) (which also refers to https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#no-longer-inferring-default-values-of-args):