From 34fc847d9f34db524eb4b1a682e897c0281009ff Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Tue, 21 Feb 2023 10:40:14 +0100 Subject: [PATCH] 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 --- .../blocks/product-elements/price/attributes.ts | 1 + .../atomic/blocks/product-elements/price/edit.tsx | 14 ++++++-------- .../blocks/product-elements/rating/attributes.ts | 2 +- .../atomic/blocks/product-elements/rating/edit.tsx | 14 ++++++-------- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/price/attributes.ts b/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/price/attributes.ts index d52d8097b47..29fcd924852 100644 --- a/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/price/attributes.ts +++ b/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/price/attributes.ts @@ -14,6 +14,7 @@ export const blockAttributes: BlockAttributes = { }, textAlign: { type: 'string', + default: 'center', }, }; diff --git a/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/price/edit.tsx b/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/price/edit.tsx index c3e77eef7bb..968107d1a72 100644 --- a/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/price/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/price/edit.tsx @@ -59,14 +59,12 @@ const PriceEdit = ( { return ( <> - { isDescendentOfQueryLoop && ( - { - setAttributes( { textAlign } ); - } } - /> - ) } + { + setAttributes( { textAlign } ); + } } + />
diff --git a/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/rating/attributes.ts b/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/rating/attributes.ts index 5d621390109..4ab1d940383 100644 --- a/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/rating/attributes.ts +++ b/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/rating/attributes.ts @@ -14,7 +14,7 @@ export const blockAttributes: BlockAttributes = { }, textAlign: { type: 'string', - default: '', + default: 'center', }, }; diff --git a/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/rating/edit.tsx b/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/rating/edit.tsx index d08fbd1aba4..1414cb579f0 100644 --- a/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/rating/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/rating/edit.tsx @@ -42,14 +42,12 @@ const Edit = ( { return ( <> - { isDescendentOfQueryLoop && ( - { - setAttributes( { textAlign: newAlign || '' } ); - } } - /> - ) } + { + setAttributes( { textAlign: newAlign || '' } ); + } } + />