Fix isDefault on Buttons and switch Toolbar with ToolbarGroup (https://github.com/woocommerce/woocommerce-blocks/pull/3577)
* Fix isDefault notice * fix Toolbar to ToolbarGroup
This commit is contained in:
parent
800f3c9624
commit
94d8d580a2
|
@ -4,7 +4,7 @@
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { useState } from '@wordpress/element';
|
import { useState } from '@wordpress/element';
|
||||||
import ProductControl from '@woocommerce/editor-components/product-control';
|
import ProductControl from '@woocommerce/editor-components/product-control';
|
||||||
import { Placeholder, Button, Toolbar } from '@wordpress/components';
|
import { Placeholder, Button, ToolbarGroup } from '@wordpress/components';
|
||||||
import { BlockControls } from '@wordpress/block-editor';
|
import { BlockControls } from '@wordpress/block-editor';
|
||||||
import TextToolbarButton from '@woocommerce/editor-components/text-toolbar-button';
|
import TextToolbarButton from '@woocommerce/editor-components/text-toolbar-button';
|
||||||
import { useProductDataContext } from '@woocommerce/shared-context';
|
import { useProductDataContext } from '@woocommerce/shared-context';
|
||||||
|
@ -55,7 +55,7 @@ const withProductSelector = ( selectorArgs ) => ( OriginalComponent ) => {
|
||||||
} }
|
} }
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
isDefault
|
isSecondary
|
||||||
disabled={ ! productId }
|
disabled={ ! productId }
|
||||||
onClick={ () => {
|
onClick={ () => {
|
||||||
setIsEditing( false );
|
setIsEditing( false );
|
||||||
|
@ -68,7 +68,7 @@ const withProductSelector = ( selectorArgs ) => ( OriginalComponent ) => {
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
<Toolbar>
|
<ToolbarGroup>
|
||||||
<TextToolbarButton
|
<TextToolbarButton
|
||||||
onClick={ () => setIsEditing( true ) }
|
onClick={ () => setIsEditing( true ) }
|
||||||
>
|
>
|
||||||
|
@ -77,7 +77,7 @@ const withProductSelector = ( selectorArgs ) => ( OriginalComponent ) => {
|
||||||
'woo-gutenberg-products-block'
|
'woo-gutenberg-products-block'
|
||||||
) }
|
) }
|
||||||
</TextToolbarButton>
|
</TextToolbarButton>
|
||||||
</Toolbar>
|
</ToolbarGroup>
|
||||||
</BlockControls>
|
</BlockControls>
|
||||||
<OriginalComponent { ...props } />
|
<OriginalComponent { ...props } />
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -43,7 +43,7 @@ const NoPaymentMethodsPlaceholder = () => {
|
||||||
) }
|
) }
|
||||||
</span>
|
</span>
|
||||||
<Button
|
<Button
|
||||||
isDefault
|
isSecondary
|
||||||
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=checkout` }
|
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=checkout` }
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
PanelBody,
|
PanelBody,
|
||||||
ToggleControl,
|
ToggleControl,
|
||||||
Button,
|
Button,
|
||||||
Toolbar,
|
ToolbarGroup,
|
||||||
withSpokenMessages,
|
withSpokenMessages,
|
||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
import { Icon, server, external } from '@woocommerce/icons';
|
import { Icon, server, external } from '@woocommerce/icons';
|
||||||
|
@ -48,7 +48,7 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak } ) => {
|
||||||
const getBlockControls = () => {
|
const getBlockControls = () => {
|
||||||
return (
|
return (
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
<Toolbar
|
<ToolbarGroup
|
||||||
controls={ [
|
controls={ [
|
||||||
{
|
{
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
|
@ -238,7 +238,7 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak } ) => {
|
||||||
</p>
|
</p>
|
||||||
<Button
|
<Button
|
||||||
className="wc-block-attribute-filter__add-attribute-button"
|
className="wc-block-attribute-filter__add-attribute-button"
|
||||||
isDefault
|
isSecondary
|
||||||
href={ getAdminLink(
|
href={ getAdminLink(
|
||||||
'edit.php?post_type=product&page=product_attributes'
|
'edit.php?post_type=product&page=product_attributes'
|
||||||
) }
|
) }
|
||||||
|
|
|
@ -25,7 +25,7 @@ const NoShippingPlaceholder = () => {
|
||||||
) }
|
) }
|
||||||
</span>
|
</span>
|
||||||
<Button
|
<Button
|
||||||
isDefault
|
isSecondary
|
||||||
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=shipping` }
|
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=shipping` }
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
|
|
|
@ -22,7 +22,7 @@ import {
|
||||||
ResizableBox,
|
ResizableBox,
|
||||||
Spinner,
|
Spinner,
|
||||||
ToggleControl,
|
ToggleControl,
|
||||||
Toolbar,
|
ToolbarGroup,
|
||||||
withSpokenMessages,
|
withSpokenMessages,
|
||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
@ -93,7 +93,7 @@ const FeaturedCategory = ( {
|
||||||
} }
|
} }
|
||||||
/>
|
/>
|
||||||
<MediaUploadCheck>
|
<MediaUploadCheck>
|
||||||
<Toolbar>
|
<ToolbarGroup>
|
||||||
<MediaUpload
|
<MediaUpload
|
||||||
onSelect={ ( media ) => {
|
onSelect={ ( media ) => {
|
||||||
setAttributes( {
|
setAttributes( {
|
||||||
|
@ -113,7 +113,7 @@ const FeaturedCategory = ( {
|
||||||
/>
|
/>
|
||||||
) }
|
) }
|
||||||
/>
|
/>
|
||||||
</Toolbar>
|
</ToolbarGroup>
|
||||||
</MediaUploadCheck>
|
</MediaUploadCheck>
|
||||||
</BlockControls>
|
</BlockControls>
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,7 +23,7 @@ import {
|
||||||
ResizableBox,
|
ResizableBox,
|
||||||
Spinner,
|
Spinner,
|
||||||
ToggleControl,
|
ToggleControl,
|
||||||
Toolbar,
|
ToolbarGroup,
|
||||||
withSpokenMessages,
|
withSpokenMessages,
|
||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
@ -146,7 +146,7 @@ const FeaturedProduct = ( {
|
||||||
} }
|
} }
|
||||||
/>
|
/>
|
||||||
<MediaUploadCheck>
|
<MediaUploadCheck>
|
||||||
<Toolbar>
|
<ToolbarGroup>
|
||||||
<MediaUpload
|
<MediaUpload
|
||||||
onSelect={ ( media ) => {
|
onSelect={ ( media ) => {
|
||||||
setAttributes( {
|
setAttributes( {
|
||||||
|
@ -166,9 +166,9 @@ const FeaturedProduct = ( {
|
||||||
/>
|
/>
|
||||||
) }
|
) }
|
||||||
/>
|
/>
|
||||||
</Toolbar>
|
</ToolbarGroup>
|
||||||
</MediaUploadCheck>
|
</MediaUploadCheck>
|
||||||
<Toolbar
|
<ToolbarGroup
|
||||||
controls={ [
|
controls={ [
|
||||||
{
|
{
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
PanelBody,
|
PanelBody,
|
||||||
Placeholder,
|
Placeholder,
|
||||||
RangeControl,
|
RangeControl,
|
||||||
Toolbar,
|
ToolbarGroup,
|
||||||
withSpokenMessages,
|
withSpokenMessages,
|
||||||
ToggleControl,
|
ToggleControl,
|
||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
|
@ -164,7 +164,7 @@ class ProductsBlock extends Component {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
<Toolbar
|
<ToolbarGroup
|
||||||
controls={ [
|
controls={ [
|
||||||
{
|
{
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
|
|
|
@ -133,7 +133,7 @@ export default function ( { attributes, setAttributes } ) {
|
||||||
</p>
|
</p>
|
||||||
<Button
|
<Button
|
||||||
className="wc-block-price-slider__add-product-button"
|
className="wc-block-price-slider__add-product-button"
|
||||||
isDefault
|
isSecondary
|
||||||
href={ getAdminLink( 'post-new.php?post_type=product' ) }
|
href={ getAdminLink( 'post-new.php?post_type=product' ) }
|
||||||
>
|
>
|
||||||
{ __( 'Add new product', 'woo-gutenberg-products-block' ) +
|
{ __( 'Add new product', 'woo-gutenberg-products-block' ) +
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
Disabled,
|
Disabled,
|
||||||
PanelBody,
|
PanelBody,
|
||||||
Placeholder,
|
Placeholder,
|
||||||
Toolbar,
|
ToolbarGroup,
|
||||||
withSpokenMessages,
|
withSpokenMessages,
|
||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
import { Component } from '@wordpress/element';
|
import { Component } from '@wordpress/element';
|
||||||
|
@ -281,7 +281,7 @@ class ProductByCategoryBlock extends Component {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
<Toolbar
|
<ToolbarGroup
|
||||||
controls={ [
|
controls={ [
|
||||||
{
|
{
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
Disabled,
|
Disabled,
|
||||||
PanelBody,
|
PanelBody,
|
||||||
Placeholder,
|
Placeholder,
|
||||||
Toolbar,
|
ToolbarGroup,
|
||||||
withSpokenMessages,
|
withSpokenMessages,
|
||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
import { Component } from '@wordpress/element';
|
import { Component } from '@wordpress/element';
|
||||||
|
@ -263,7 +263,7 @@ class ProductsByTagBlock extends Component {
|
||||||
return HAS_TAGS ? (
|
return HAS_TAGS ? (
|
||||||
<>
|
<>
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
<Toolbar
|
<ToolbarGroup
|
||||||
controls={ [
|
controls={ [
|
||||||
{
|
{
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
Disabled,
|
Disabled,
|
||||||
PanelBody,
|
PanelBody,
|
||||||
Placeholder,
|
Placeholder,
|
||||||
Toolbar,
|
ToolbarGroup,
|
||||||
withSpokenMessages,
|
withSpokenMessages,
|
||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
import { Component } from '@wordpress/element';
|
import { Component } from '@wordpress/element';
|
||||||
|
@ -164,7 +164,7 @@ class ProductsByAttributeBlock extends Component {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
<Toolbar
|
<ToolbarGroup
|
||||||
controls={ [
|
controls={ [
|
||||||
{
|
{
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
withSpokenMessages,
|
withSpokenMessages,
|
||||||
Placeholder,
|
Placeholder,
|
||||||
Button,
|
Button,
|
||||||
Toolbar,
|
ToolbarGroup,
|
||||||
Disabled,
|
Disabled,
|
||||||
Tip,
|
Tip,
|
||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
|
@ -139,7 +139,7 @@ class Editor extends Component {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
<Toolbar
|
<ToolbarGroup
|
||||||
controls={ [
|
controls={ [
|
||||||
{
|
{
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
|
|
|
@ -33,7 +33,7 @@ export const renderNoProductsPlaceholder = ( blockTitle, blockIcon ) => (
|
||||||
</p>
|
</p>
|
||||||
<Button
|
<Button
|
||||||
className="wc-block-products__add-product-button"
|
className="wc-block-products__add-product-button"
|
||||||
isDefault
|
isSecondary
|
||||||
href={ ADMIN_URL + 'post-new.php?post_type=product' }
|
href={ ADMIN_URL + 'post-new.php?post_type=product' }
|
||||||
>
|
>
|
||||||
{ __( 'Add new product', 'woo-gutenberg-products-block' ) + ' ' }
|
{ __( 'Add new product', 'woo-gutenberg-products-block' ) + ' ' }
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { createInterpolateElement } from 'wordpress-element';
|
||||||
import {
|
import {
|
||||||
Notice,
|
Notice,
|
||||||
ToggleControl,
|
ToggleControl,
|
||||||
Toolbar,
|
ToolbarGroup,
|
||||||
RangeControl,
|
RangeControl,
|
||||||
SelectControl,
|
SelectControl,
|
||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
|
@ -20,7 +20,7 @@ import ToggleButtonControl from '@woocommerce/editor-components/toggle-button-co
|
||||||
|
|
||||||
export const getBlockControls = ( editMode, setAttributes ) => (
|
export const getBlockControls = ( editMode, setAttributes ) => (
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
<Toolbar
|
<ToolbarGroup
|
||||||
controls={ [
|
controls={ [
|
||||||
{
|
{
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { BlockControls } from '@wordpress/block-editor';
|
import { BlockControls } from '@wordpress/block-editor';
|
||||||
import { Toolbar } from '@wordpress/components';
|
import { ToolbarGroup } from '@wordpress/components';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds controls to the editor toolbar.
|
* Adds controls to the editor toolbar.
|
||||||
|
@ -15,7 +15,7 @@ import { Toolbar } from '@wordpress/components';
|
||||||
const EditorBlockControls = ( { isEditing, setIsEditing } ) => {
|
const EditorBlockControls = ( { isEditing, setIsEditing } ) => {
|
||||||
return (
|
return (
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
<Toolbar
|
<ToolbarGroup
|
||||||
controls={ [
|
controls={ [
|
||||||
{
|
{
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
|
|
|
@ -85,7 +85,7 @@ const Editor = ( {
|
||||||
setAttributes={ setAttributes }
|
setAttributes={ setAttributes }
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
isDefault
|
isSecondary
|
||||||
onClick={ () => {
|
onClick={ () => {
|
||||||
setIsEditing( false );
|
setIsEditing( false );
|
||||||
} }
|
} }
|
||||||
|
|
|
@ -28,7 +28,7 @@ const ErrorPlaceholder = ( { className, error, isLoading, onRetry } ) => (
|
||||||
{ isLoading ? (
|
{ isLoading ? (
|
||||||
<Spinner />
|
<Spinner />
|
||||||
) : (
|
) : (
|
||||||
<Button isDefault onClick={ onRetry }>
|
<Button isSecondary onClick={ onRetry }>
|
||||||
{ __( 'Retry', 'woo-gutenberg-products-block' ) }
|
{ __( 'Retry', 'woo-gutenberg-products-block' ) }
|
||||||
</Button>
|
</Button>
|
||||||
) }
|
) }
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import { range } from 'lodash';
|
import { range } from 'lodash';
|
||||||
import { __, sprintf } from '@wordpress/i18n';
|
import { __, sprintf } from '@wordpress/i18n';
|
||||||
import { Component } from '@wordpress/element';
|
import { Component } from '@wordpress/element';
|
||||||
import { Toolbar } from '@wordpress/components';
|
import { ToolbarGroup } from '@wordpress/components';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
|
@ -38,7 +38,7 @@ class HeadingToolbar extends Component {
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Toolbar
|
<ToolbarGroup
|
||||||
isCollapsed={ isCollapsed }
|
isCollapsed={ isCollapsed }
|
||||||
icon={ <HeadingLevelIcon level={ selectedLevel } /> }
|
icon={ <HeadingLevelIcon level={ selectedLevel } /> }
|
||||||
controls={ range( minLevel, maxLevel ).map( ( index ) =>
|
controls={ range( minLevel, maxLevel ).map( ( index ) =>
|
||||||
|
|
|
@ -68,7 +68,7 @@ class ToggleButtonControl extends Component {
|
||||||
buttonArgs.isPrimary = true;
|
buttonArgs.isPrimary = true;
|
||||||
buttonArgs[ 'aria-pressed' ] = true;
|
buttonArgs[ 'aria-pressed' ] = true;
|
||||||
} else {
|
} else {
|
||||||
buttonArgs.isDefault = true;
|
buttonArgs.isSecondary = true;
|
||||||
buttonArgs[ 'aria-pressed' ] = false;
|
buttonArgs[ 'aria-pressed' ] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue