* Improve title for edit button woocommerce/woocommerce-blocks#1689

Improve title for edit button

* fix edit title for Product By Attribute and All Products blocks
This commit is contained in:
Luigi Teschio 2021-11-10 14:53:07 +01:00 committed by GitHub
parent 645d534bda
commit b5875d13ca
11 changed files with 34 additions and 12 deletions

View File

@ -111,7 +111,10 @@ const FeaturedCategory = ( {
controls={ [
{
icon: 'edit',
title: __( 'Edit', 'woo-gutenberg-products-block' ),
title: __(
'Edit selected category',
'woo-gutenberg-products-block'
),
onClick: () =>
setAttributes( { editMode: ! editMode } ),
isActive: editMode,

View File

@ -161,7 +161,10 @@ const FeaturedProduct = ( {
controls={ [
{
icon: 'edit',
title: __( 'Edit', 'woo-gutenberg-products-block' ),
title: __(
'Edit selected product',
'woo-gutenberg-products-block'
),
onClick: () =>
setAttributes( { editMode: ! editMode } ),
isActive: editMode,

View File

@ -170,7 +170,7 @@ class ProductsBlock extends Component {
{
icon: 'edit',
title: __(
'Edit',
'Edit selected products',
'woo-gutenberg-products-block'
),
onClick: () =>

View File

@ -291,7 +291,7 @@ class ProductByCategoryBlock extends Component {
{
icon: 'edit',
title: __(
'Edit',
'Edit selected categories',
'woo-gutenberg-products-block'
),
onClick: () =>

View File

@ -273,7 +273,7 @@ class ProductsByTagBlock extends Component {
{
icon: 'edit',
title: __(
'Edit',
'Edit selected tags',
'woo-gutenberg-products-block'
),
onClick: () =>

View File

@ -171,7 +171,7 @@ class ProductsByAttributeBlock extends Component {
{
icon: 'edit',
title: __(
'Edit',
'Edit selected attribute',
'woo-gutenberg-products-block'
),
onClick: () =>

View File

@ -148,7 +148,10 @@ class Editor extends Component {
controls={ [
{
icon: 'edit',
title: __( 'Edit', 'woo-gutenberg-products-block' ),
title: __(
'Edit inner product layout',
'woo-gutenberg-products-block'
),
onClick: () => this.togglePreview(),
isActive: isEditing,
},

View File

@ -14,13 +14,13 @@ import { BlockControls } from '@wordpress/block-editor';
import { getAdminLink, getSetting } from '@woocommerce/settings';
import ToggleButtonControl from '@woocommerce/editor-components/toggle-button-control';
export const getBlockControls = ( editMode, setAttributes ) => (
export const getBlockControls = ( editMode, setAttributes, buttonTitle ) => (
<BlockControls>
<ToolbarGroup
controls={ [
{
icon: 'edit',
title: __( 'Edit', 'woo-gutenberg-products-block' ),
title: buttonTitle,
onClick: () => setAttributes( { editMode: ! editMode } ),
isActive: editMode,
},

View File

@ -139,9 +139,14 @@ const ReviewsByCategoryEditor = ( {
return renderEditMode();
}
const buttonTitle = __(
'Edit selected categories',
'woo-gutenberg-products-block'
);
return (
<>
{ getBlockControls( editMode, setAttributes ) }
{ getBlockControls( editMode, setAttributes, buttonTitle ) }
{ getInspectorControls() }
<EditorContainerBlock
attributes={ attributes }

View File

@ -162,9 +162,14 @@ const ReviewsByProductEditor = ( {
return renderEditMode();
}
const buttonTitle = __(
'Edit selected product',
'woo-gutenberg-products-block'
);
return (
<>
{ getBlockControls( editMode, setAttributes ) }
{ getBlockControls( editMode, setAttributes, buttonTitle ) }
{ getInspectorControls() }
<EditorContainerBlock
attributes={ attributes }

View File

@ -19,7 +19,10 @@ const EditorBlockControls = ( { isEditing, setIsEditing } ) => {
controls={ [
{
icon: 'edit',
title: __( 'Edit', 'woo-gutenberg-products-block' ),
title: __(
'Edit selected product',
'woo-gutenberg-products-block'
),
onClick: () => setIsEditing( ! isEditing ),
isActive: isEditing,
},