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

Move more block SVGs to the icons package #19834

Merged
merged 2 commits into from
Jan 23, 2020
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
8 changes: 0 additions & 8 deletions packages/block-library/src/column/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/column/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { column as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';

Expand Down
8 changes: 0 additions & 8 deletions packages/block-library/src/columns/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/columns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { columns as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import deprecated from './deprecated';
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import patterns from './patterns';
import save from './save';
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/cover/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ import {
} from '@wordpress/block-editor';
import { __ } from '@wordpress/i18n';
import { withDispatch } from '@wordpress/data';
import { cover as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import icon from './icon';
import {
IMAGE_BACKGROUND_TYPE,
VIDEO_BACKGROUND_TYPE,
Expand Down
6 changes: 0 additions & 6 deletions packages/block-library/src/cover/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/cover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { cover as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import deprecated from './deprecated';
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import transforms from './transforms';
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/file/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import {
} from '@wordpress/block-editor';
import { Component } from '@wordpress/element';
import { __, _x } from '@wordpress/i18n';
import { file as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import icon from './icon';
import FileBlockInspector from './inspector';

class FileEdit extends Component {
Expand Down
6 changes: 0 additions & 6 deletions packages/block-library/src/file/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/file/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { file as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import transforms from './transforms';
Expand Down
9 changes: 1 addition & 8 deletions packages/block-library/src/gallery/icons.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
/**
* WordPress dependencies
*/
import { G, Path, SVG } from '@wordpress/components';

export const icon = (
<SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<Path fill="none" d="M0 0h24v24H0V0z" />
<G><Path d="M20 4v12H8V4h12m0-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 9.67l1.69 2.26 2.48-3.1L19 15H9zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z" /></G>
</SVG>
);
import { Path, SVG } from '@wordpress/components';

export const leftArrow = (
<SVG width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/gallery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { gallery as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import deprecated from './deprecated';
import edit from './edit';
import { icon } from './icons';
import metadata from './block.json';
import save from './save';
import transforms from './transforms';
Expand Down
6 changes: 1 addition & 5 deletions packages/block-library/src/gallery/shared-icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
* WordPress dependencies
*/
import { BlockIcon } from '@wordpress/block-editor';

/**
* Internal dependencies
*/
import { icon } from './icons.js';
import { gallery as icon } from '@wordpress/icons';

export const sharedIcon = <BlockIcon icon={ icon } />;
2 changes: 1 addition & 1 deletion packages/block-library/src/gallery/shared-icon.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
*/
import { Icon } from '@wordpress/components';
import { withPreferredColorScheme } from '@wordpress/compose';
import { gallery as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import { icon } from './icons.js';
import styles from './styles.scss';

const IconWithColorScheme = withPreferredColorScheme( ( { getStylesFromColorScheme } ) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/group/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
*/
import { __ } from '@wordpress/i18n';
import { createBlock } from '@wordpress/blocks';
import { group as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import deprecated from './deprecated';
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';

Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/html/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { html as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import transforms from './transforms';
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ import {
import { __, sprintf } from '@wordpress/i18n';
import { getPath } from '@wordpress/url';
import { withViewportMatch } from '@wordpress/viewport';
import { image as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import { createUpgradedEmbedBlock } from '../embed/util';
import icon from './icon';
import ImageSize from './image-size';
/**
* Module constants
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
ToolbarButton,
ToolbarGroup,
} from '@wordpress/components';

import {
BlockCaption,
MediaPlaceholder,
Expand All @@ -41,12 +40,13 @@ import { isURL } from '@wordpress/url';
import { doAction, hasAction } from '@wordpress/hooks';
import { compose, withPreferredColorScheme } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
import { image as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import styles from './styles.scss';
import SvgIcon, { editImageIcon } from './icon';
import { editImageIcon } from './icon';
import SvgIconRetry from './icon-retry';
import { getUpdatedLinkTargetSettings } from './utils';

Expand Down Expand Up @@ -303,7 +303,7 @@ export class ImageEdit extends React.Component {
iconStyle = this.props.getStylesFromColorScheme( styles.iconUpload, styles.iconUploadDark );
break;
}
return <Icon icon={ SvgIcon } { ...iconStyle } />;
return <Icon icon={ icon } { ...iconStyle } />;
}

render() {
Expand Down
2 changes: 0 additions & 2 deletions packages/block-library/src/image/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
*/
import { Path, Rect, SVG } from '@wordpress/components';

export default <SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><Path d="M0,0h24v24H0V0z" fill="none" /><Path d="m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z" /><Path d="m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z" /></SVG>;

export const editImageIcon = ( <SVG width={ 20 } height={ 20 } viewBox="0 0 20 20"><Rect x={ 11 } y={ 3 } width={ 7 } height={ 5 } rx={ 1 } /><Rect x={ 2 } y={ 12 } width={ 7 } height={ 5 } rx={ 1 } /><Path d="M13,12h1a3,3,0,0,1-3,3v2a5,5,0,0,0,5-5h1L15,9Z" /><Path d="M4,8H3l2,3L7,8H6A3,3,0,0,1,9,5V3A5,5,0,0,0,4,8Z" /></SVG> );
2 changes: 1 addition & 1 deletion packages/block-library/src/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { image as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import deprecated from './deprecated';
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import transforms from './transforms';
Expand Down
8 changes: 0 additions & 8 deletions packages/block-library/src/latest-comments/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/latest-comments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { comment as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import edit from './edit';
import icon from './icon';

export const name = 'core/latest-comments';

Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/latest-posts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { postList as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import edit from './edit';
import icon from './icon';

export const name = 'core/latest-posts';

Expand Down
8 changes: 0 additions & 8 deletions packages/block-library/src/legacy-widget/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/legacy-widget/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { widget as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import edit from './edit';
import icon from './icon';

export const name = 'core/legacy-widget';

Expand Down
8 changes: 0 additions & 8 deletions packages/block-library/src/list/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { list as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import transforms from './transforms';
Expand Down
6 changes: 0 additions & 6 deletions packages/block-library/src/media-text/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/media-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { mediaAndText as icon } from '@wordpress/icons';
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it's it makes mroe sense to use mediaAndText as the name of the icon you import, rather than simply icon? It's entirely possible I'm missing some React nuance here, but what if you imported two icons?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, if you import two icons it's better to keep the icon name. The advantage of using icon here is that you can use shorthand syntax in the block settings icon, instead of icon: mediaAndText. In the end, it's not that important though.


/**
* Internal dependencies
*/
import deprecated from './deprecated';
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import transforms from './transforms';
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/more/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { more as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import transforms from './transforms';
Expand Down
8 changes: 0 additions & 8 deletions packages/block-library/src/nextpage/icon.js

This file was deleted.

Loading