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

Try new icons for reusable blocks and template parts. #34002

Merged
merged 4 commits into from
Aug 11, 2021
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
14 changes: 2 additions & 12 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import {
getPossibleBlockTransformations,
parse,
} from '@wordpress/blocks';
import { SVG, Rect, G, Path } from '@wordpress/components';
import { Platform } from '@wordpress/element';
import { symbol } from '@wordpress/icons';

/**
* A block selection object.
Expand All @@ -46,14 +46,6 @@ import { Platform } from '@wordpress/element';
const MILLISECONDS_PER_HOUR = 3600 * 1000;
const MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000;
const templateIcon = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<Rect x="0" fill="none" width="24" height="24" />
<G>
<Path d="M19 3H5c-1.105 0-2 .895-2 2v14c0 1.105.895 2 2 2h14c1.105 0 2-.895 2-2V5c0-1.105-.895-2-2-2zM6 6h5v5H6V6zm4.5 13C9.12 19 8 17.88 8 16.5S9.12 14 10.5 14s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zm3-6l3-5 3 5h-6z" />
</G>
</SVG>
);

/**
* Shared reference to an empty array for cases where it is important to avoid
Expand Down Expand Up @@ -1587,9 +1579,7 @@ export const getInserterItems = createSelector(
name: 'core/block',
initialAttributes: { ref: reusableBlock.id },
title: reusableBlock.title.raw,
icon: referencedBlockType
? referencedBlockType.icon
: templateIcon,
icon: referencedBlockType ? referencedBlockType.icon : symbol,
category: 'reusable',
keywords: [],
isDisabled: false,
Expand Down
6 changes: 6 additions & 0 deletions packages/block-library/src/block/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* WordPress dependencies
*/
import { symbol as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
Expand All @@ -10,4 +15,5 @@ export { metadata, name };

export const settings = {
edit,
icon,
};
4 changes: 2 additions & 2 deletions packages/block-library/src/template-part/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { startCase } from 'lodash';
*/
import { store as coreDataStore } from '@wordpress/core-data';
import { select } from '@wordpress/data';
import { layout } from '@wordpress/icons';
import { symbolFilled } from '@wordpress/icons';
import { addFilter } from '@wordpress/hooks';

/**
Expand All @@ -22,7 +22,7 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
icon: layout,
icon: symbolFilled,
__experimentalLabel: ( { slug, theme } ) => {
// Attempt to find entity title if block is a template part.
// Require slug to request, otherwise entity is uncreated and will throw 404.
Expand Down
2 changes: 2 additions & 0 deletions packages/icons/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export { default as removeBug } from './library/remove-bug';
export { default as replace } from './library/replace';
export { default as resizeCornerNE } from './library/resize-corner-n-e';
export { default as reusableBlock } from './library/reusable-block';
export { default as symbol } from './library/symbol';
export { default as rotateLeft } from './library/rotate-left';
export { default as rotateRight } from './library/rotate-right';
export { default as rss } from './library/rss';
Expand Down Expand Up @@ -204,6 +205,7 @@ export { default as tableRowBefore } from './library/table-row-before';
export { default as tableRowDelete } from './library/table-row-delete';
export { default as table } from './library/table';
export { default as tag } from './library/tag';
export { default as symbolFilled } from './library/symbol-filled';
export { default as termDescription } from './library/term-description';
export { default as footer } from './library/footer';
export { default as header } from './library/header';
Expand Down
12 changes: 12 additions & 0 deletions packages/icons/src/library/symbol-filled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* WordPress dependencies
*/
import { SVG, Path } from '@wordpress/primitives';

const symbolFilled = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<Path d="M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" />
</SVG>
);

export default symbolFilled;
12 changes: 12 additions & 0 deletions packages/icons/src/library/symbol.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* WordPress dependencies
*/
import { SVG, Path } from '@wordpress/primitives';

const symbol = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<Path d="M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" />
</SVG>
);

export default symbol;