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

Created a new package containing all icons #9648

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@wordpress/hooks": "file:packages/hooks",
"@wordpress/html-entities": "file:packages/html-entities",
"@wordpress/i18n": "file:packages/i18n",
"@wordpress/icons": "file:packages/icons",
"@wordpress/is-shallow-equal": "file:packages/is-shallow-equal",
"@wordpress/keycodes": "file:packages/keycodes",
"@wordpress/nux": "file:packages/nux",
Expand Down
4 changes: 3 additions & 1 deletion packages/block-library/src/video/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ import {
import { Component, Fragment, createRef } from '@wordpress/element';
import {
BlockControls,
BlockIcon,
InspectorControls,
MediaPlaceholder,
MediaUpload,
RichText,
mediaUpload,
} from '@wordpress/editor';
import { getBlobByURL } from '@wordpress/blob';
import { video as videoIcon } from '@wordpress/icons';

class VideoEdit extends Component {
constructor() {
Expand Down Expand Up @@ -129,7 +131,7 @@ class VideoEdit extends Component {
if ( editing ) {
return (
<MediaPlaceholder
icon="media-video"
icon={ <BlockIcon icon={ videoIcon } /> }
labels={ {
title: __( 'Video' ),
name: __( 'a video' ),
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/video/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { __ } from '@wordpress/i18n';
import { RichText } from '@wordpress/editor';
import { createBlock } from '@wordpress/blocks';
import { createBlobURL } from '@wordpress/blob';
import { video as videoIcon } from '@wordpress/icons';
Copy link
Member

Choose a reason for hiding this comment

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

You could probably do this a bit differently:

import { video as icon } from '@wordpress/icons';

and then later in the file be able to use icon, instead of icon: videoIcon.


/**
* Internal dependencies
Expand All @@ -18,7 +19,7 @@ export const settings = {

description: __( 'Embed a video file and a simple video player.' ),

icon: <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0V0z" /><path d="M4 6l2 4h14v8H4V6m18-2h-4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4L2 6v12l2 2h16l2-2V4z" /></svg>,
icon: videoIcon,

keywords: [ __( 'movie' ) ],

Expand Down
27 changes: 27 additions & 0 deletions packages/icons/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions packages/icons/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@wordpress/icons",
"version": "1.0.0",
"description": "Icons for Gutenberg.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
"keywords": [
"wordpress",
"icons"
],
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/icons/README.md",
"repository": {
"type": "git",
"url": "https://github.com/WordPress/gutenberg.git"
},
"bugs": {
"url": "https://github.com/WordPress/gutenberg/issues"
},
"main": "index.js",
"dependencies": {
},
"devDependencies": {
},
"publishConfig": {
"access": "public"
}
}