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:
Seghir Nadir 2020-12-21 17:03:54 +01:00 committed by GitHub
parent 800f3c9624
commit 94d8d580a2
19 changed files with 37 additions and 37 deletions

View File

@ -4,7 +4,7 @@
import { __ } from '@wordpress/i18n';
import { useState } from '@wordpress/element';
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 TextToolbarButton from '@woocommerce/editor-components/text-toolbar-button';
import { useProductDataContext } from '@woocommerce/shared-context';
@ -55,7 +55,7 @@ const withProductSelector = ( selectorArgs ) => ( OriginalComponent ) => {
} }
/>
<Button
isDefault
isSecondary
disabled={ ! productId }
onClick={ () => {
setIsEditing( false );
@ -68,7 +68,7 @@ const withProductSelector = ( selectorArgs ) => ( OriginalComponent ) => {
) : (
<>
<BlockControls>
<Toolbar>
<ToolbarGroup>
<TextToolbarButton
onClick={ () => setIsEditing( true ) }
>
@ -77,7 +77,7 @@ const withProductSelector = ( selectorArgs ) => ( OriginalComponent ) => {
'woo-gutenberg-products-block'
) }
</TextToolbarButton>
</Toolbar>
</ToolbarGroup>
</BlockControls>
<OriginalComponent { ...props } />
</>

View File

@ -43,7 +43,7 @@ const NoPaymentMethodsPlaceholder = () => {
) }
</span>
<Button
isDefault
isSecondary
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=checkout` }
target="_blank"
rel="noopener noreferrer"

View File

@ -10,7 +10,7 @@ import {
PanelBody,
ToggleControl,
Button,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import { Icon, server, external } from '@woocommerce/icons';
@ -48,7 +48,7 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak } ) => {
const getBlockControls = () => {
return (
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',
@ -238,7 +238,7 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak } ) => {
</p>
<Button
className="wc-block-attribute-filter__add-attribute-button"
isDefault
isSecondary
href={ getAdminLink(
'edit.php?post_type=product&page=product_attributes'
) }

View File

@ -25,7 +25,7 @@ const NoShippingPlaceholder = () => {
) }
</span>
<Button
isDefault
isSecondary
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=shipping` }
target="_blank"
rel="noopener noreferrer"

View File

@ -22,7 +22,7 @@ import {
ResizableBox,
Spinner,
ToggleControl,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import classnames from 'classnames';
@ -93,7 +93,7 @@ const FeaturedCategory = ( {
} }
/>
<MediaUploadCheck>
<Toolbar>
<ToolbarGroup>
<MediaUpload
onSelect={ ( media ) => {
setAttributes( {
@ -113,7 +113,7 @@ const FeaturedCategory = ( {
/>
) }
/>
</Toolbar>
</ToolbarGroup>
</MediaUploadCheck>
</BlockControls>
);

View File

@ -23,7 +23,7 @@ import {
ResizableBox,
Spinner,
ToggleControl,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import classnames from 'classnames';
@ -146,7 +146,7 @@ const FeaturedProduct = ( {
} }
/>
<MediaUploadCheck>
<Toolbar>
<ToolbarGroup>
<MediaUpload
onSelect={ ( media ) => {
setAttributes( {
@ -166,9 +166,9 @@ const FeaturedProduct = ( {
/>
) }
/>
</Toolbar>
</ToolbarGroup>
</MediaUploadCheck>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',

View File

@ -10,7 +10,7 @@ import {
PanelBody,
Placeholder,
RangeControl,
Toolbar,
ToolbarGroup,
withSpokenMessages,
ToggleControl,
} from '@wordpress/components';
@ -164,7 +164,7 @@ class ProductsBlock extends Component {
return (
<>
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',

View File

@ -133,7 +133,7 @@ export default function ( { attributes, setAttributes } ) {
</p>
<Button
className="wc-block-price-slider__add-product-button"
isDefault
isSecondary
href={ getAdminLink( 'post-new.php?post_type=product' ) }
>
{ __( 'Add new product', 'woo-gutenberg-products-block' ) +

View File

@ -9,7 +9,7 @@ import {
Disabled,
PanelBody,
Placeholder,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import { Component } from '@wordpress/element';
@ -281,7 +281,7 @@ class ProductByCategoryBlock extends Component {
return (
<>
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',

View File

@ -9,7 +9,7 @@ import {
Disabled,
PanelBody,
Placeholder,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import { Component } from '@wordpress/element';
@ -263,7 +263,7 @@ class ProductsByTagBlock extends Component {
return HAS_TAGS ? (
<>
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',

View File

@ -9,7 +9,7 @@ import {
Disabled,
PanelBody,
Placeholder,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import { Component } from '@wordpress/element';
@ -164,7 +164,7 @@ class ProductsByAttributeBlock extends Component {
return (
<>
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',

View File

@ -14,7 +14,7 @@ import {
withSpokenMessages,
Placeholder,
Button,
Toolbar,
ToolbarGroup,
Disabled,
Tip,
} from '@wordpress/components';
@ -139,7 +139,7 @@ class Editor extends Component {
return (
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',

View File

@ -33,7 +33,7 @@ export const renderNoProductsPlaceholder = ( blockTitle, blockIcon ) => (
</p>
<Button
className="wc-block-products__add-product-button"
isDefault
isSecondary
href={ ADMIN_URL + 'post-new.php?post_type=product' }
>
{ __( 'Add new product', 'woo-gutenberg-products-block' ) + ' ' }

View File

@ -6,7 +6,7 @@ import { createInterpolateElement } from 'wordpress-element';
import {
Notice,
ToggleControl,
Toolbar,
ToolbarGroup,
RangeControl,
SelectControl,
} from '@wordpress/components';
@ -20,7 +20,7 @@ import ToggleButtonControl from '@woocommerce/editor-components/toggle-button-co
export const getBlockControls = ( editMode, setAttributes ) => (
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',

View File

@ -3,7 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { BlockControls } from '@wordpress/block-editor';
import { Toolbar } from '@wordpress/components';
import { ToolbarGroup } from '@wordpress/components';
/**
* Adds controls to the editor toolbar.
@ -15,7 +15,7 @@ import { Toolbar } from '@wordpress/components';
const EditorBlockControls = ( { isEditing, setIsEditing } ) => {
return (
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',

View File

@ -85,7 +85,7 @@ const Editor = ( {
setAttributes={ setAttributes }
/>
<Button
isDefault
isSecondary
onClick={ () => {
setIsEditing( false );
} }

View File

@ -28,7 +28,7 @@ const ErrorPlaceholder = ( { className, error, isLoading, onRetry } ) => (
{ isLoading ? (
<Spinner />
) : (
<Button isDefault onClick={ onRetry }>
<Button isSecondary onClick={ onRetry }>
{ __( 'Retry', 'woo-gutenberg-products-block' ) }
</Button>
) }

View File

@ -4,7 +4,7 @@
import { range } from 'lodash';
import { __, sprintf } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { Toolbar } from '@wordpress/components';
import { ToolbarGroup } from '@wordpress/components';
/**
* Internal dependencies
@ -38,7 +38,7 @@ class HeadingToolbar extends Component {
} = this.props;
return (
<Toolbar
<ToolbarGroup
isCollapsed={ isCollapsed }
icon={ <HeadingLevelIcon level={ selectedLevel } /> }
controls={ range( minLevel, maxLevel ).map( ( index ) =>

View File

@ -68,7 +68,7 @@ class ToggleButtonControl extends Component {
buttonArgs.isPrimary = true;
buttonArgs[ 'aria-pressed' ] = true;
} else {
buttonArgs.isDefault = true;
buttonArgs.isSecondary = true;
buttonArgs[ 'aria-pressed' ] = false;
}