Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions packages/components/src/icon/stories/index.story.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
/**
* External dependencies
*/
import type { Meta, StoryFn } from '@storybook/react-vite';

/**
* WordPress dependencies
*/
import { SVG, Path } from '@wordpress/primitives';
import { wordpress } from '@wordpress/icons';

/**
* Internal dependencies
*/
import Icon from '..';
import { VStack } from '../../v-stack';

const meta: Meta< typeof Icon > = {
tags: [ 'manifest' ],
title: 'Components/Icon',
component: Icon,
parameters: {
controls: { expanded: true },
docs: { canvas: { sourceState: 'shown' } },
componentStatus: {
status: 'recommended',
status: 'use-with-caution',
whereUsed: 'global',
notes: 'Prefer this component over the `Icon` component from `@wordpress/icons`.',
notes: 'When rendering SVGs, use `Icon` from `@wordpress/ui` instead.',
},
Comment on lines 13 to 17

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not in a hurry to ban this in the use-recommended-components lint, because there are some usage patterns that are intentionally not supported in the new Icon component.

It would probably be better to audit those unsupported usage patterns and have some migration guidance ready first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we all love a good dashicon

},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ ruleTester.run( 'use-recommended-components', rule, {

// Allowed @wordpress/ui components.
"import { Badge } from '@wordpress/ui';",
"import { Icon } from '@wordpress/ui';",
"import { Link } from '@wordpress/ui';",
"import { Stack } from '@wordpress/ui';",
"import { Text } from '@wordpress/ui';",
"import { Badge, Link, Stack, Text } from '@wordpress/ui';",
"import { Badge, Icon, Link, Stack, Text } from '@wordpress/ui';",
],

invalid: [
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin/rules/use-recommended-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const ALLOWLIST = {
'Collapsible',
'CollapsibleCard',
'EmptyState',
'Icon',
'Link',
'Stack',
'Text',
Expand Down
5 changes: 3 additions & 2 deletions packages/ui/src/icon/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Icon } from '../index';
const meta: Meta< typeof Icon > = {
title: 'Design System/Components/Icon',
component: Icon,
tags: [ 'manifest' ],
decorators: [
( Story ) => {
return (
Expand All @@ -20,9 +21,9 @@ const meta: Meta< typeof Icon > = {
],
parameters: {
componentStatus: {
status: 'use-with-caution',
status: 'recommended',
whereUsed: 'global',
notes: 'Not yet recommended for use alongside components from `@wordpress/components`, pending a general readiness review. See [WordPress/gutenberg#76135](https://github.com/WordPress/gutenberg/issues/76135).',
notes: 'Prefer this component over the `Icon` component from `@wordpress/components` or `@wordpress/icons`.',
},
},
};
Expand Down
Loading