-
-
Notifications
You must be signed in to change notification settings - Fork 9.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 #13125 from storybookjs/feat/sortArgs
Controls: Add ArgsTable sorting
- Loading branch information
Showing
7 changed files
with
162 additions
and
37 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
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,11 @@ | ||
```js | ||
// YourComponent.stories.js | YourComponent.stories.ts | ||
|
||
import { YourComponent } from './your-component' | ||
|
||
export default { | ||
title:'My Story', | ||
component: YourComponent, | ||
parameters: { controls: { sort: 'requiredFirst' } }, | ||
}; | ||
``` |
12 changes: 12 additions & 0 deletions
12
docs/snippets/common/component-story-sort-controls.mdx.mdx
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,12 @@ | ||
```md | ||
<!--- YourComponent.stories.mdx --> | ||
|
||
import { Meta } from '@storybook/addon-docs/blocks'; | ||
import { YourComponent } from './your-component' | ||
|
||
<Meta | ||
title='My Story' | ||
component={YourComponent} | ||
parameters={{ controls: { sort: 'requiredFirst' } }} | ||
/> | ||
``` |
33 changes: 33 additions & 0 deletions
33
examples/official-storybook/stories/controls-sort.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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
|
||
export default { | ||
title: 'Addons/Controls-Sort', | ||
argTypes: { | ||
x: { type: { required: true } }, | ||
y: { type: { required: true }, table: { category: 'foo' } }, | ||
z: {}, | ||
a: { type: { required: true } }, | ||
b: { table: { category: 'foo' } }, | ||
c: {}, | ||
}, | ||
args: { | ||
x: 'x', | ||
y: 'y', | ||
z: 'z', | ||
a: 'a', | ||
b: 'b', | ||
c: 'c', | ||
}, | ||
parameters: { chromatic: { disable: true } }, | ||
}; | ||
|
||
const Template = (args: any) => <div>{args && <pre>{JSON.stringify(args, null, 2)}</pre>}</div>; | ||
|
||
export const None = Template.bind({}); | ||
None.parameters = { controls: { sort: 'none' } }; | ||
|
||
export const Alpha = Template.bind({}); | ||
Alpha.parameters = { controls: { sort: 'alpha' } }; | ||
|
||
export const RequiredFirst = Template.bind({}); | ||
RequiredFirst.parameters = { controls: { sort: 'requiredFirst' } }; |
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