Skip to content
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

Deprecate duplicate icons #38849

Merged
merged 5 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
15 changes: 14 additions & 1 deletion packages/components/src/mobile/inserter-button/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { Component } from '@wordpress/element';
import { Icon } from '@wordpress/components';
import { withPreferredColorScheme } from '@wordpress/compose';
import { __, sprintf } from '@wordpress/i18n';
import { sparkles } from '@wordpress/icons';
import { BlockIcon } from '@wordpress/block-editor';
import { SVG, Path } from '@wordpress/primitives';

/**
* Internal dependencies
Expand Down Expand Up @@ -66,6 +66,19 @@ class MenuItem extends Component {
item.title
);

const sparkles = (
<SVG
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<Path
d="M10 11c-1.588-.479-4-.91-4-.91s2-.241 4-.454c1.8-.191 3.365-.502 4-3.181C14.635 3.775 15 1 15 1s.365 2.775 1 5.455c.635 2.679 2 2.969 4 3.181 2 .213 4 .455 4 .455s-2.412.43-4 .909c-1.588.479-3 1-4 4.546-.746 2.643-.893 4.948-1 5.454-.107-.506-.167-2.5-1-5.454C13 12 11.588 11.479 10 11zM7.333 3.5C6.803 3.333 6 3.182 6 3.182s.667-.085 1.333-.16c.6-.066 1.122-.175 1.334-1.113C8.878.971 9 0 9 0s.122.971.333 1.91c.212.937.667 1.038 1.334 1.113.666.074 1.333.159 1.333.159s-.804.15-1.333.318c-.53.167-1 .35-1.334 1.59C9.085 6.017 9.036 6.824 9 7c-.036-.177-.056-.875-.333-1.91-.334-1.24-.804-1.423-1.334-1.59zM2.444 18C1.474 17.713 0 17.454 0 17.454s1.222-.145 2.444-.272c1.1-.115 2.057-.302 2.445-1.91C5.277 13.666 5.5 12 5.5 12s.223 1.665.611 3.273c.388 1.607 1.222 1.781 2.445 1.909 1.222.127 2.444.273 2.444.273s-1.474.258-2.444.545c-.971.287-1.834.6-2.445 2.727-.456 1.586-.546 2.97-.611 3.273-.065-.304-.102-1.5-.611-3.273C4.278 18.6 3.415 18.287 2.444 18z"
fill="#F0C930"
/>
</SVG>
);

Copy link
Member

Choose a reason for hiding this comment

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

might be worth moving the sparkles icon module from the icons package into this package. sure it's fine having the SVG defined inline here, but it's obviously generated/optimized and so practically un-editable in place and so a bit awkward in the middle of another component.

not a big issue and some may disagree with me on this, but I think keeping it an import from another file would make it easier to think about and maintain. we wouldn't have to call it sparkles even; we could give it a semantic name like block-is-new-icon.svg and then people would have the freedom to change it to something that isn't sparkles without changing the intent of the code/module/import.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a bunch, that's much better. I took a stab at that in 499d4dc, hopefully I got the code right.

return (
<TouchableHighlight
style={ [
Expand Down
12 changes: 6 additions & 6 deletions packages/editor/src/components/editor-help/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import { __ } from '@wordpress/i18n';
import {
helpFilled,
plusCircleFilled,
alignJustifyAlt,
trashFilled,
cogAlt,
alignJustify,
trash,
cog,
} from '@wordpress/icons';
import { useSelect } from '@wordpress/data';
import { store as editorStore } from '@wordpress/editor';
Expand Down Expand Up @@ -53,11 +53,11 @@ const HELP_TOPICS = [
icon: plusCircleFilled,
view: <AddBlocks />,
},
{ label: __( 'Move blocks' ), icon: alignJustifyAlt, view: <MoveBlocks /> },
{ label: __( 'Remove blocks' ), icon: trashFilled, view: <RemoveBlocks /> },
{ label: __( 'Move blocks' ), icon: alignJustify, view: <MoveBlocks /> },
{ label: __( 'Remove blocks' ), icon: trash, view: <RemoveBlocks /> },
{
label: __( 'Customize blocks' ),
icon: cogAlt,
icon: cog,
view: <CustomizeBlocks />,
},
];
Expand Down
4 changes: 4 additions & 0 deletions packages/icons/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## Breaking Change

- Removed icons that were added by mistake: `alignJustifyAlt`, `cogAlt`, `sparkles`, `trashFilled`.

## 6.3.0 (2022-02-10)

### New Features
Expand Down
4 changes: 0 additions & 4 deletions packages/icons/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export { default as addCard } from './library/add-card';
export { default as addSubmenu } from './library/add-submenu';
export { default as alignCenter } from './library/align-center';
export { default as alignJustify } from './library/align-justify';
export { default as alignJustifyAlt } from './library/align-justify-alt';
export { default as alignLeft } from './library/align-left';
export { default as alignNone } from './library/align-none';
export { default as alignRight } from './library/align-right';
Expand Down Expand Up @@ -44,7 +43,6 @@ export { default as cloudUpload } from './library/cloud-upload';
export { default as cloud } from './library/cloud';
export { default as code } from './library/code';
export { default as cog } from './library/cog';
export { default as cogAlt } from './library/cog-alt';
export { default as color } from './library/color';
export { default as column } from './library/column';
export { default as columns } from './library/columns';
Expand Down Expand Up @@ -195,7 +193,6 @@ export { default as share } from './library/share';
export { default as shield } from './library/shield';
export { default as shortcode } from './library/shortcode';
export { default as siteLogo } from './library/site-logo';
export { default as sparkles } from './library/sparkles';
export { default as stack } from './library/stack';
export { default as starEmpty } from './library/star-empty';
export { default as starFilled } from './library/star-filled';
Expand Down Expand Up @@ -227,7 +224,6 @@ export { default as title } from './library/title';
export { default as tip } from './library/tip';
export { default as tool } from './library/tool';
export { default as trash } from './library/trash';
export { default as trashFilled } from './library/trash-filled';
export { default as trendingDown } from './library/trending-down';
export { default as trendingUp } from './library/trending-up';
export { default as typography } from './library/typography';
Expand Down
16 changes: 0 additions & 16 deletions packages/icons/src/library/align-justify-alt.js

This file was deleted.

16 changes: 0 additions & 16 deletions packages/icons/src/library/cog-alt.js

This file was deleted.

15 changes: 0 additions & 15 deletions packages/icons/src/library/sparkles.js

This file was deleted.

16 changes: 0 additions & 16 deletions packages/icons/src/library/trash-filled.js

This file was deleted.