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:
parent
33b3a1d82d
commit
34fc847d9f
|
@ -14,6 +14,7 @@ export const blockAttributes: BlockAttributes = {
|
||||||
},
|
},
|
||||||
textAlign: {
|
textAlign: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
default: 'center',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,14 +59,12 @@ const PriceEdit = ( {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
{ isDescendentOfQueryLoop && (
|
|
||||||
<AlignmentToolbar
|
<AlignmentToolbar
|
||||||
value={ attributes.textAlign }
|
value={ attributes.textAlign }
|
||||||
onChange={ ( textAlign: AllowedAlignments ) => {
|
onChange={ ( textAlign: AllowedAlignments ) => {
|
||||||
setAttributes( { textAlign } );
|
setAttributes( { textAlign } );
|
||||||
} }
|
} }
|
||||||
/>
|
/>
|
||||||
) }
|
|
||||||
</BlockControls>
|
</BlockControls>
|
||||||
<div { ...blockProps }>
|
<div { ...blockProps }>
|
||||||
<Block { ...blockAttrs } />
|
<Block { ...blockAttrs } />
|
||||||
|
|
|
@ -14,7 +14,7 @@ export const blockAttributes: BlockAttributes = {
|
||||||
},
|
},
|
||||||
textAlign: {
|
textAlign: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: 'center',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,14 +42,12 @@ const Edit = ( {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BlockControls>
|
<BlockControls>
|
||||||
{ isDescendentOfQueryLoop && (
|
|
||||||
<AlignmentToolbar
|
<AlignmentToolbar
|
||||||
value={ attributes.textAlign }
|
value={ attributes.textAlign }
|
||||||
onChange={ ( newAlign ) => {
|
onChange={ ( newAlign ) => {
|
||||||
setAttributes( { textAlign: newAlign || '' } );
|
setAttributes( { textAlign: newAlign || '' } );
|
||||||
} }
|
} }
|
||||||
/>
|
/>
|
||||||
) }
|
|
||||||
</BlockControls>
|
</BlockControls>
|
||||||
<div { ...blockProps }>
|
<div { ...blockProps }>
|
||||||
<Block { ...blockAttrs } />
|
<Block { ...blockAttrs } />
|
||||||
|
|
Loading…
Reference in New Issue