Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Fix isDefault on Buttons and switch Toolbar with ToolbarGroup (#3577)
Browse files Browse the repository at this point in the history
* Fix isDefault notice

* fix Toolbar to ToolbarGroup
  • Loading branch information
senadir committed Dec 21, 2020
1 parent f1e423b commit 01649ae
Show file tree
Hide file tree
Showing 19 changed files with 37 additions and 37 deletions.
Expand Up @@ -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';
Expand Down Expand Up @@ -55,7 +55,7 @@ const withProductSelector = ( selectorArgs ) => ( OriginalComponent ) => {
} }
/>
<Button
isDefault
isSecondary
disabled={ ! productId }
onClick={ () => {
setIsEditing( false );
Expand All @@ -68,7 +68,7 @@ const withProductSelector = ( selectorArgs ) => ( OriginalComponent ) => {
) : (
<>
<BlockControls>
<Toolbar>
<ToolbarGroup>
<TextToolbarButton
onClick={ () => setIsEditing( true ) }
>
Expand All @@ -77,7 +77,7 @@ const withProductSelector = ( selectorArgs ) => ( OriginalComponent ) => {
'woo-gutenberg-products-block'
) }
</TextToolbarButton>
</Toolbar>
</ToolbarGroup>
</BlockControls>
<OriginalComponent { ...props } />
</>
Expand Down
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions assets/js/blocks/attribute-filter/edit.js
Expand Up @@ -10,7 +10,7 @@ import {
PanelBody,
ToggleControl,
Button,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import { Icon, server, external } from '@woocommerce/icons';
Expand Down Expand Up @@ -48,7 +48,7 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak } ) => {
const getBlockControls = () => {
return (
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',
Expand Down Expand Up @@ -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'
) }
Expand Down
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions assets/js/blocks/featured-category/block.js
Expand Up @@ -22,7 +22,7 @@ import {
ResizableBox,
Spinner,
ToggleControl,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import classnames from 'classnames';
Expand Down Expand Up @@ -93,7 +93,7 @@ const FeaturedCategory = ( {
} }
/>
<MediaUploadCheck>
<Toolbar>
<ToolbarGroup>
<MediaUpload
onSelect={ ( media ) => {
setAttributes( {
Expand All @@ -113,7 +113,7 @@ const FeaturedCategory = ( {
/>
) }
/>
</Toolbar>
</ToolbarGroup>
</MediaUploadCheck>
</BlockControls>
);
Expand Down
8 changes: 4 additions & 4 deletions assets/js/blocks/featured-product/block.js
Expand Up @@ -23,7 +23,7 @@ import {
ResizableBox,
Spinner,
ToggleControl,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import classnames from 'classnames';
Expand Down Expand Up @@ -146,7 +146,7 @@ const FeaturedProduct = ( {
} }
/>
<MediaUploadCheck>
<Toolbar>
<ToolbarGroup>
<MediaUpload
onSelect={ ( media ) => {
setAttributes( {
Expand All @@ -166,9 +166,9 @@ const FeaturedProduct = ( {
/>
) }
/>
</Toolbar>
</ToolbarGroup>
</MediaUploadCheck>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',
Expand Down
4 changes: 2 additions & 2 deletions assets/js/blocks/handpicked-products/block.js
Expand Up @@ -10,7 +10,7 @@ import {
PanelBody,
Placeholder,
RangeControl,
Toolbar,
ToolbarGroup,
withSpokenMessages,
ToggleControl,
} from '@wordpress/components';
Expand Down Expand Up @@ -164,7 +164,7 @@ class ProductsBlock extends Component {
return (
<>
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/price-filter/edit.js
Expand Up @@ -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' ) +
Expand Down
4 changes: 2 additions & 2 deletions assets/js/blocks/product-category/block.js
Expand Up @@ -9,7 +9,7 @@ import {
Disabled,
PanelBody,
Placeholder,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import { Component } from '@wordpress/element';
Expand Down Expand Up @@ -281,7 +281,7 @@ class ProductByCategoryBlock extends Component {
return (
<>
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',
Expand Down
4 changes: 2 additions & 2 deletions assets/js/blocks/product-tag/block.js
Expand Up @@ -9,7 +9,7 @@ import {
Disabled,
PanelBody,
Placeholder,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import { Component } from '@wordpress/element';
Expand Down Expand Up @@ -263,7 +263,7 @@ class ProductsByTagBlock extends Component {
return HAS_TAGS ? (
<>
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',
Expand Down
4 changes: 2 additions & 2 deletions assets/js/blocks/products-by-attribute/block.js
Expand Up @@ -9,7 +9,7 @@ import {
Disabled,
PanelBody,
Placeholder,
Toolbar,
ToolbarGroup,
withSpokenMessages,
} from '@wordpress/components';
import { Component } from '@wordpress/element';
Expand Down Expand Up @@ -164,7 +164,7 @@ class ProductsByAttributeBlock extends Component {
return (
<>
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',
Expand Down
4 changes: 2 additions & 2 deletions assets/js/blocks/products/all-products/edit.js
Expand Up @@ -14,7 +14,7 @@ import {
withSpokenMessages,
Placeholder,
Button,
Toolbar,
ToolbarGroup,
Disabled,
Tip,
} from '@wordpress/components';
Expand Down Expand Up @@ -139,7 +139,7 @@ class Editor extends Component {

return (
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/products/utils.js
Expand Up @@ -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' ) + ' ' }
Expand Down
4 changes: 2 additions & 2 deletions assets/js/blocks/reviews/edit-utils.js
Expand Up @@ -6,7 +6,7 @@ import { createInterpolateElement } from 'wordpress-element';
import {
Notice,
ToggleControl,
Toolbar,
ToolbarGroup,
RangeControl,
SelectControl,
} from '@wordpress/components';
Expand All @@ -20,7 +20,7 @@ import ToggleButtonControl from '@woocommerce/editor-components/toggle-button-co

export const getBlockControls = ( editMode, setAttributes ) => (
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',
Expand Down
4 changes: 2 additions & 2 deletions assets/js/blocks/single-product/edit/editor-block-controls.js
Expand Up @@ -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.
Expand All @@ -15,7 +15,7 @@ import { Toolbar } from '@wordpress/components';
const EditorBlockControls = ( { isEditing, setIsEditing } ) => {
return (
<BlockControls>
<Toolbar
<ToolbarGroup
controls={ [
{
icon: 'edit',
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/single-product/edit/index.js
Expand Up @@ -85,7 +85,7 @@ const Editor = ( {
setAttributes={ setAttributes }
/>
<Button
isDefault
isSecondary
onClick={ () => {
setIsEditing( false );
} }
Expand Down
2 changes: 1 addition & 1 deletion assets/js/editor-components/error-placeholder/index.js
Expand Up @@ -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>
) }
Expand Down
4 changes: 2 additions & 2 deletions assets/js/editor-components/heading-toolbar/index.js
Expand Up @@ -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
Expand Down Expand Up @@ -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 ) =>
Expand Down
2 changes: 1 addition & 1 deletion assets/js/editor-components/toggle-button-control/index.js
Expand Up @@ -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;
}

Expand Down

0 comments on commit 01649ae

Please sign in to comment.