All Products: Re-add alignment controls for Product Rating and Price (https://github.com/woocommerce/woocommerce-blocks/pull/8264)

* Product Rating and Price: Re-add alignment controls in the All Products context.

* Add default values to align attributes for price and rating product elements

---------

Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
This commit is contained in:
Daniel Dudzic 2023-02-21 10:40:14 +01:00 committed by GitHub
parent 33b3a1d82d
commit 34fc847d9f
4 changed files with 14 additions and 17 deletions

View File

@ -14,6 +14,7 @@ export const blockAttributes: BlockAttributes = {
},
textAlign: {
type: 'string',
default: 'center',
},
};

View File

@ -59,14 +59,12 @@ const PriceEdit = ( {
return (
<>
<BlockControls>
{ isDescendentOfQueryLoop && (
<AlignmentToolbar
value={ attributes.textAlign }
onChange={ ( textAlign: AllowedAlignments ) => {
setAttributes( { textAlign } );
} }
/>
) }
</BlockControls>
<div { ...blockProps }>
<Block { ...blockAttrs } />

View File

@ -14,7 +14,7 @@ export const blockAttributes: BlockAttributes = {
},
textAlign: {
type: 'string',
default: '',
default: 'center',
},
};

View File

@ -42,14 +42,12 @@ const Edit = ( {
return (
<>
<BlockControls>
{ isDescendentOfQueryLoop && (
<AlignmentToolbar
value={ attributes.textAlign }
onChange={ ( newAlign ) => {
setAttributes( { textAlign: newAlign || '' } );
} }
/>
) }
</BlockControls>
<div { ...blockProps }>
<Block { ...blockAttrs } />