Skip to content

Commit

Permalink
Storybook: Add badges to private components (#58123)
Browse files Browse the repository at this point in the history
* Storybook: Set up badges for private components

* Add badges

* Add badge for WIP
  • Loading branch information
mirka authored Jan 25, 2024
1 parent 246db96 commit 5712094
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 0 deletions.
32 changes: 32 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"@emotion/babel-plugin": "11.3.0",
"@emotion/jest": "11.7.1",
"@emotion/native": "11.0.0",
"@geometricpanda/storybook-addon-badges": "2.0.1",
"@octokit/rest": "16.26.0",
"@octokit/types": "6.34.0",
"@octokit/webhooks-types": "5.6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const meta: Meta< typeof CustomSelect > = {
value: { control: { type: null } },
},
parameters: {
badges: [ 'wip' ],
actions: { argTypesRegex: '^on.*' },
controls: { expanded: true },
docs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const meta: Meta< typeof DropdownMenu > = {
},
parameters: {
actions: { argTypesRegex: '^on.*' },
badges: [ 'private' ],
controls: { expanded: true },
docs: {
canvas: { sourceState: 'shown' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const meta: Meta< typeof ProgressBar > = {
value: { control: { type: 'number', min: 0, max: 100, step: 1 } },
},
parameters: {
badges: [ 'private' ],
controls: {
expanded: true,
},
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/tabs/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const meta: Meta< typeof Tabs > = {
},
parameters: {
actions: { argTypesRegex: '^on.*' },
badges: [ 'private' ],
controls: { expanded: true },
docs: { canvas: { sourceState: 'shown' } },
},
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/theme/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const meta: Meta< typeof Theme > = {
background: { control: { type: 'color' } },
},
parameters: {
badges: [ 'private' ],
controls: { expanded: true },
docs: { canvas: { sourceState: 'shown' } },
},
Expand Down
1 change: 1 addition & 0 deletions storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module.exports = {
'@storybook/addon-toolbars',
'@storybook/addon-actions',
'storybook-source-link',
'@geometricpanda/storybook-addon-badges',
],
framework: {
name: '@storybook/react-webpack5',
Expand Down
24 changes: 24 additions & 0 deletions storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,30 @@ export const decorators = [
];

export const parameters = {
// For @geometricpanda/storybook-addon-badges
badgesConfig: {
private: {
title: '🔒 Private',
tooltip: {
title: 'Component is locked as a private API',
desc: 'We do not yet recommend using this outside of the Gutenberg codebase.',
links: [
{
title: 'About @wordpress/private-apis',
href: 'https://developer.wordpress.org/block-editor/reference-guides/packages/packages-private-apis/',
},
],
},
},
wip: {
title: '🚧 WIP',
styles: { backgroundColor: '#FFF0BD' },
tooltip: {
title: 'Component is a work in progress',
desc: 'This component is not ready for use in production, including the Gutenberg codebase. DO NOT export outside of @wordpress/components.',
},
},
},
controls: {
sort: 'requiredFirst',
},
Expand Down

0 comments on commit 5712094

Please sign in to comment.