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 icons to the icons package #19838

Merged
merged 2 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion packages/block-library/src/post-content/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 { postContent as icon } from '@wordpress/icons';

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

const { name } = metadata;
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-title/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 { title as icon } from '@wordpress/icons';

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

const { name } = metadata;
Expand Down
8 changes: 0 additions & 8 deletions packages/block-library/src/preformatted/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/preformatted/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 { preformatted 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/pullquote/icon.js

This file was deleted.

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

/**
* Internal dependencies
*/
import { SOLID_COLOR_STYLE_NAME } from './shared';
import deprecated from './deprecated';
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/quote/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/quote/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 { quote 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/separator/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/separator/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 { separator 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/shortcode/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/shortcode/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 { shortcode as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import edit from './edit';
import icon from './icon';
import save from './save';
import transforms from './transforms';
import metadata from './block.json';
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/site-title/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 { mapMarker as icon } from '@wordpress/icons';

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

const { name } = metadata;
Expand Down
8 changes: 0 additions & 8 deletions packages/block-library/src/spacer/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/spacer/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 { arrowExpand 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/subhead/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/subhead/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 { subtitle 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 think we retired the subheading block. Moreso perhaps "subtitle" isn't the best name as I think of that as video subtitles, and it's entirely possible a video block lands in the future with the ability to toggle subtitles.

Copy link
Contributor Author

@youknowriad youknowriad Jan 23, 2020

Choose a reason for hiding this comment

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

It's retired yes but it's still in the code with its own icon. So open for suggestions about the naming here


/**
* 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/table/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
ToggleControl,
ToolbarGroup,
} from '@wordpress/components';
import { table as icon } from '@wordpress/icons';

/**
* Internal dependencies
Expand All @@ -41,7 +42,6 @@ import {
toggleSection,
isEmptyTableSection,
} from './state';
import icon from './icon';

const BACKGROUND_COLORS = [
{
Expand Down
8 changes: 0 additions & 8 deletions packages/block-library/src/table/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/table/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 { table 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/verse/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/verse/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 { verse 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 there's a more generic name for this icon:

Screenshot 2020-01-23 at 13 39 49

The general principle is, describe the icon, not the function.

Then there are some gray areas where the icon was created for a particular block, like "page break" and such.

This one is hard though — perhaps verse is fine, because I can't think of when you'd otherwise use this icon.


/**
* 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/video/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ import {
import {
withSelect,
} from '@wordpress/data';
import { video as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import { createUpgradedEmbedBlock } from '../embed/util';
import icon from './icon';
import VideoCommonSettings from './edit-common-settings';

const ALLOWED_MEDIA_TYPES = [ 'video' ];
Expand Down
7 changes: 0 additions & 7 deletions packages/block-library/src/video/icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/video/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 { video 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
13 changes: 13 additions & 0 deletions packages/icons/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { default as Icon } from './icon';

export { default as archive } from './library/archive';
export { default as arrowExpand } from './library/arrow-expand';
export { default as audio } from './library/audio';
export { default as button } from './library/button';
export { default as calendar } from './library/calendar';
Expand All @@ -18,9 +19,21 @@ export { default as group } from './library/group';
export { default as html } from './library/html';
export { default as image } from './library/image';
export { default as list } from './library/list';
export { default as mapMarker } from './library/map-marker';
export { default as mediaAndText } from './library/media-and-text';
export { default as more } from './library/more';
export { default as pageBreak } from './library/page-break';
export { default as paragraph } from './library/paragraph';
export { default as postContent } from './library/post-content';
export { default as postList } from './library/post-list';
export { default as preformatted } from './library/preformatted';
export { default as pullquote } from './library/pullquote';
export { default as quote } from './library/quote';
export { default as separator } from './library/separator';
export { default as shortcode } from './library/shortcode';
export { default as subtitle } from './library/subtitle';
export { default as table } from './library/table';
export { default as title } from './library/title';
export { default as verse } from './library/verse';
export { default as video } from './library/video';
export { default as widget } from './library/widget';
12 changes: 12 additions & 0 deletions packages/icons/src/library/arrow-expand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* WordPress dependencies
*/
import { Path, SVG } from '@wordpress/primitives';

const arrowExpand = (
<SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<Path d="M13 4v2h3.59L6 16.59V13H4v7h7v-2H7.41L18 7.41V11h2V4h-7" />
</SVG>
);

export default arrowExpand;
4 changes: 2 additions & 2 deletions packages/icons/src/library/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
*/
import { SVG, Path } from '@wordpress/primitives';

const saved = (
const check = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you.

<SVG xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 24 24">
<Path d="M15.3 5.3l-6.8 6.8-2.8-2.8-1.4 1.4 4.2 4.2 8.2-8.2" />
</SVG>
);

export default saved;
export default check;

Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/**
* WordPress dependencies
*/
import { SVG, Path, Circle } from '@wordpress/components';
import { SVG, Path, Circle } from '@wordpress/primitives';

export default (
const mapMarker = (
<SVG xmlns="https://www.w3.org/2000/svg" viewBox="0 0 24 24">
<Path fill="none" d="M0 0h24v24H0V0z" />
<Path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zM7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 2.88-2.88 7.19-5 9.88C9.92 16.21 7 11.85 7 9z" />
<Circle cx="12" cy="9" r="2.5" />
</SVG>
);

export default mapMarker;
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/**
* WordPress dependencies
*/
import { SVG, Path } from '@wordpress/components';
import { SVG, Path } from '@wordpress/primitives';

export default (
const postContent = (
<SVG xmlns="https://www.w3.org/2000/svg" viewBox="0 0 24 24">
<Path fill="none" d="M0 0h24v24H0V0z" />
<Path d="M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z" />
</SVG>
);

export default postContent;
Loading