Skip to content

Commit

Permalink
Ensure icons for image/video are SVG components (#15863)
Browse files Browse the repository at this point in the history
In #15551, these were changed to support passing props, but that also means
that when you pass the video icon to the `Icon` component, it won't inject the
right size, since it's not a SVG component.

Instead, we can export the new function to allow for a customizable icon, while
exporting the SVG component by default.
  • Loading branch information
koke authored and hypest committed May 30, 2019
1 parent 81a8b1a commit 4319ad3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { doAction, hasAction } from '@wordpress/hooks';
*/
import styles from './styles.scss';
import MediaUploadProgress from './media-upload-progress';
import SvgIcon from './icon';
import { SvgIcon } from './icon';
import SvgIconRetry from './icon-retry';

const LINK_DESTINATION_CUSTOM = 'custom';
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/image/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/
import { Path, SVG } from '@wordpress/components';

function svg( props ) {
export function SvgIcon( props ) {
return <SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" { ...props }><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 default svg;
export default SvgIcon( {} );
2 changes: 1 addition & 1 deletion packages/block-library/src/video/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { doAction, hasAction } from '@wordpress/hooks';
*/
import MediaUploadProgress from '../image/media-upload-progress';
import style from './style.scss';
import SvgIcon from './icon';
import { SvgIcon } from './icon';
import SvgIconRetry from './icon-retry';

const VIDEO_ASPECT_RATIO = 1.7;
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/video/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/
import { Path, SVG } from '@wordpress/components';

function svg( props ) {
export function SvgIcon( props ) {
return <SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" { ...props }><Path fill="none" d="M0 0h24v24H0V0z" /><Path d="M4 6.47L5.76 10H20v8H4V6.47M22 4h-4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4z" /></SVG>;
}

export default svg;
export default SvgIcon( {} );

0 comments on commit 4319ad3

Please sign in to comment.