Skip to content

Commit

Permalink
Image: Update Rich Image Icons (#22819)
Browse files Browse the repository at this point in the history
* Replace rich-image icons with new ones

* Remove inner scope crop variable

* Remove unused icon file
  • Loading branch information
ajlende authored Jun 8, 2020
1 parent 8c14843 commit 2f3ea7b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 105 deletions.
82 changes: 0 additions & 82 deletions packages/block-library/src/rich-image/rich-image/icon.js

This file was deleted.

44 changes: 21 additions & 23 deletions packages/block-library/src/rich-image/rich-image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ import {
__experimentalBlock as Block,
} from '@wordpress/block-editor';
import { Fragment, Component } from '@wordpress/element';
import {
rotateLeft,
rotateRight,
flipHorizontal,
flipVertical,
crop,
aspectRatio,
} from '@wordpress/icons';
import {
ToolbarGroup,
ToolbarButton,
Expand All @@ -31,14 +39,6 @@ import { compose } from '@wordpress/compose';
* Internal dependencies
*/
import richImageRequest from './api';
import {
RotateLeftIcon,
RotateRightIcon,
FlipHorizontalIcon,
FlipVerticalIcon,
CropIcon,
AspectIcon,
} from './icon';

const ROTATE_STEP = 90;
const DEFAULT_CROP = {
Expand Down Expand Up @@ -102,13 +102,11 @@ class RichImage extends Component {
}

cropImage() {
const { crop } = this.state;

this.adjustImage( 'crop', {
cropX: crop.x,
cropY: crop.y,
cropWidth: crop.width,
cropHeight: crop.height,
cropX: this.state.crop.x,
cropY: this.state.crop.y,
cropWidth: this.state.crop.width,
cropHeight: this.state.crop.height,
} );
}

Expand Down Expand Up @@ -214,13 +212,13 @@ class RichImage extends Component {
<ToolbarItem>
{ ( toggleProps ) => (
<DropdownMenu
icon={ <RotateLeftIcon /> }
icon={ rotateLeft }
label={ __( 'Rotate' ) }
popoverProps={ POPOVER_PROPS }
toggleProps={ toggleProps }
controls={ [
{
icon: <RotateLeftIcon />,
icon: rotateLeft,
title: __( 'Rotate left' ),
isDisabled: inProgress,
onClick: () =>
Expand All @@ -232,7 +230,7 @@ class RichImage extends Component {
),
},
{
icon: <RotateRightIcon />,
icon: rotateRight,
title: __( 'Rotate right' ),
isDisabled: inProgress,
onClick: () =>
Expand All @@ -250,13 +248,13 @@ class RichImage extends Component {
<ToolbarItem>
{ ( toggleProps ) => (
<DropdownMenu
icon={ <FlipVerticalIcon /> }
icon={ flipVertical }
label={ __( 'Flip' ) }
popoverProps={ POPOVER_PROPS }
toggleProps={ toggleProps }
controls={ [
{
icon: <FlipVerticalIcon />,
icon: flipVertical,
title: __( 'Flip vertical' ),
isDisabled: inProgress,
onClick: () =>
Expand All @@ -265,7 +263,7 @@ class RichImage extends Component {
} ),
},
{
icon: <FlipHorizontalIcon />,
icon: flipHorizontal,
title: __( 'Flip horizontal' ),
isDisabled: inProgress,
onClick: () =>
Expand All @@ -279,7 +277,7 @@ class RichImage extends Component {
</ToolbarItem>
<ToolbarButton
disabled={ inProgress }
icon={ <CropIcon /> }
icon={ crop }
label={ __( 'Crop' ) }
onClick={ () =>
this.setState( {
Expand All @@ -296,14 +294,14 @@ class RichImage extends Component {
<BlockControls>
<ToolbarGroup>
<div className="richimage__crop-icon">
<Icon icon={ CropIcon } />
<Icon icon={ crop } />
</div>
</ToolbarGroup>
<ToolbarGroup>
<ToolbarItem>
{ ( toggleProps ) => (
<DropdownMenu
icon={ <AspectIcon /> }
icon={ aspectRatio }
label={ __( 'Aspect Ratio' ) }
popoverProps={ POPOVER_PROPS }
toggleProps={ toggleProps }
Expand Down

0 comments on commit 2f3ea7b

Please sign in to comment.