Skip to content

Commit

Permalink
RNMobile - Replace Icon in toolbar for media editing (#20841)
Browse files Browse the repository at this point in the history
* RNMobile - Replace Icon - Removes duplicated icon and adds it to the icons library, used in Cover, Media & Text and Image block

* Storybook - Update snapshot

* RNMobile - Video block - Update edit media icon

* Icons - Update Replace Icon

* Storybook - Update snapshot
  • Loading branch information
Gerardo Pacheco authored Mar 13, 2020
1 parent b0784b1 commit f1ff508
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 36 deletions.
13 changes: 0 additions & 13 deletions packages/block-library/src/cover/edit-media-icon.native.js

This file was deleted.

5 changes: 2 additions & 3 deletions packages/block-library/src/cover/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
import { compose, withPreferredColorScheme } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
import { useEffect } from '@wordpress/element';
import { cover as icon } from '@wordpress/icons';
import { cover as icon, replace } from '@wordpress/icons';

/**
* Internal dependencies
Expand All @@ -43,7 +43,6 @@ import {
IMAGE_BACKGROUND_TYPE,
VIDEO_BACKGROUND_TYPE,
} from './shared';
import { EditMediaIcon } from './edit-media-icon';

/**
* Constants
Expand Down Expand Up @@ -141,7 +140,7 @@ const Cover = ( {
<ToolbarGroup>
<ToolbarButton
title={ __( 'Edit cover media' ) }
icon={ EditMediaIcon }
icon={ replace }
onClick={ open }
/>
</ToolbarGroup>
Expand Down
11 changes: 8 additions & 3 deletions packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ import { isURL } from '@wordpress/url';
import { doAction, hasAction } from '@wordpress/hooks';
import { compose, withPreferredColorScheme } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
import { external, link, image as icon, textColor } from '@wordpress/icons';
import {
external,
link,
image as icon,
textColor,
replace,
} from '@wordpress/icons';

/**
* Internal dependencies
*/
import styles from './styles.scss';
import { editImageIcon } from './icon';
import SvgIconRetry from './icon-retry';
import SvgIconCustomize from './icon-customize';
import { getUpdatedLinkTargetSettings } from './utils';
Expand Down Expand Up @@ -373,7 +378,7 @@ export class ImageEdit extends React.Component {
<ToolbarGroup>
<ToolbarButton
title={ __( 'Edit image' ) }
icon={ editImageIcon }
icon={ replace }
onClick={ open }
/>
</ToolbarGroup>
Expand Down
13 changes: 0 additions & 13 deletions packages/block-library/src/image/icon.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { Component } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { isURL } from '@wordpress/url';
import { compose, withPreferredColorScheme } from '@wordpress/compose';
import { pencil } from '@wordpress/icons';
import { replace } from '@wordpress/icons';

/**
* Internal dependencies
Expand Down Expand Up @@ -131,7 +131,7 @@ class MediaContainer extends Component {
<Button
className="components-toolbar__control"
label={ __( 'Edit media' ) }
icon={ pencil }
icon={ replace }
onClick={ open }
/>
</ToolbarGroup>
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/video/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
import { __, sprintf } from '@wordpress/i18n';
import { isURL } from '@wordpress/url';
import { doAction, hasAction } from '@wordpress/hooks';
import { video as SvgIcon, pencil } from '@wordpress/icons';
import { video as SvgIcon, replace } from '@wordpress/icons';

/**
* Internal dependencies
Expand Down Expand Up @@ -204,7 +204,7 @@ class VideoEdit extends React.Component {
{ getMediaOptions() }
<ToolbarButton
label={ __( 'Edit video' ) }
icon={ pencil }
icon={ replace }
onClick={ open }
/>
</ToolbarGroup>
Expand Down
1 change: 1 addition & 0 deletions packages/icons/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export { default as pullRight } from './library/pull-right';
export { default as pullquote } from './library/pullquote';
export { default as quote } from './library/quote';
export { default as redo } from './library/redo';
export { default as replace } from './library/replace';
export { default as resizeCornerNE } from './library/resize-corner-n-e';
export { default as rss } from './library/rss';
export { default as search } from './library/search';
Expand Down
12 changes: 12 additions & 0 deletions packages/icons/src/library/replace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* WordPress dependencies
*/
import { Path, SVG } from '@wordpress/primitives';

const replace = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<Path d="M16 10h4c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1zm-8 4H4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm10-2.6L14.5 15l1.1 1.1 1.7-1.7c-.1 1.1-.3 2.3-.9 2.9-.3.3-.7.5-1.3.5h-4.5v1.5H15c.9 0 1.7-.3 2.3-.9 1-1 1.3-2.7 1.4-4l1.8 1.8 1.1-1.1-3.6-3.7zM6.8 9.7c.1-1.1.3-2.3.9-2.9.4-.4.8-.6 1.3-.6h4.5V4.8H9c-.9 0-1.7.3-2.3.9-1 1-1.3 2.7-1.4 4L3.5 8l-1 1L6 12.6 9.5 9l-1-1-1.7 1.7z" />
</SVG>
);

export default replace;
57 changes: 57 additions & 0 deletions storybook/test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14166,6 +14166,63 @@ exports[`Storyshots Icons/Icon Library 1`] = `
/>
</svg>
</div>
<div
style={
Object {
"alignItems": "center",
"display": "flex",
}
}
>
<strong
style={
Object {
"width": "120px",
}
}
>
replace
</strong>
<svg
aria-hidden="true"
focusable="false"
height={24}
role="img"
viewBox="0 0 24 24"
width={24}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M16 10h4c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1zm-8 4H4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm10-2.6L14.5 15l1.1 1.1 1.7-1.7c-.1 1.1-.3 2.3-.9 2.9-.3.3-.7.5-1.3.5h-4.5v1.5H15c.9 0 1.7-.3 2.3-.9 1-1 1.3-2.7 1.4-4l1.8 1.8 1.1-1.1-3.6-3.7zM6.8 9.7c.1-1.1.3-2.3.9-2.9.4-.4.8-.6 1.3-.6h4.5V4.8H9c-.9 0-1.7.3-2.3.9-1 1-1.3 2.7-1.4 4L3.5 8l-1 1L6 12.6 9.5 9l-1-1-1.7 1.7z"
/>
</svg>
<svg
aria-hidden="true"
focusable="false"
height={36}
role="img"
viewBox="0 0 24 24"
width={36}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M16 10h4c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1zm-8 4H4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm10-2.6L14.5 15l1.1 1.1 1.7-1.7c-.1 1.1-.3 2.3-.9 2.9-.3.3-.7.5-1.3.5h-4.5v1.5H15c.9 0 1.7-.3 2.3-.9 1-1 1.3-2.7 1.4-4l1.8 1.8 1.1-1.1-3.6-3.7zM6.8 9.7c.1-1.1.3-2.3.9-2.9.4-.4.8-.6 1.3-.6h4.5V4.8H9c-.9 0-1.7.3-2.3.9-1 1-1.3 2.7-1.4 4L3.5 8l-1 1L6 12.6 9.5 9l-1-1-1.7 1.7z"
/>
</svg>
<svg
aria-hidden="true"
focusable="false"
height={48}
role="img"
viewBox="0 0 24 24"
width={48}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M16 10h4c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1zm-8 4H4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm10-2.6L14.5 15l1.1 1.1 1.7-1.7c-.1 1.1-.3 2.3-.9 2.9-.3.3-.7.5-1.3.5h-4.5v1.5H15c.9 0 1.7-.3 2.3-.9 1-1 1.3-2.7 1.4-4l1.8 1.8 1.1-1.1-3.6-3.7zM6.8 9.7c.1-1.1.3-2.3.9-2.9.4-.4.8-.6 1.3-.6h4.5V4.8H9c-.9 0-1.7.3-2.3.9-1 1-1.3 2.7-1.4 4L3.5 8l-1 1L6 12.6 9.5 9l-1-1-1.7 1.7z"
/>
</svg>
</div>
<div
style={
Object {
Expand Down

0 comments on commit f1ff508

Please sign in to comment.