Fix "Product Price" block margin on the "All products" block (https://github.com/woocommerce/woocommerce-blocks/pull/8518)

* Only use margin for the feature plugin

* Return empty style if no support for spacing styling
This commit is contained in:
Alba Rincón 2023-02-27 14:38:45 +01:00 committed by GitHub
parent ada39c2378
commit 90e68175cf
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,6 @@
* External dependencies * External dependencies
*/ */
import { __experimentalGetSpacingClassesAndStyles } from '@wordpress/block-editor'; import { __experimentalGetSpacingClassesAndStyles } from '@wordpress/block-editor';
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
import { isObject } from '@woocommerce/types'; import { isObject } from '@woocommerce/types';
import { parseStyle } from '@woocommerce/base-utils'; import { parseStyle } from '@woocommerce/base-utils';
@ -14,11 +13,12 @@ type WithStyle = {
// @todo The @wordpress/block-editor dependency should never be used on the frontend of the store due to excessive side and its dependency on @wordpress/components // @todo The @wordpress/block-editor dependency should never be used on the frontend of the store due to excessive side and its dependency on @wordpress/components
// @see https://github.com/woocommerce/woocommerce-blocks/issues/8071 // @see https://github.com/woocommerce/woocommerce-blocks/issues/8071
export const useSpacingProps = ( attributes: unknown ): WithStyle => { export const useSpacingProps = ( attributes: unknown ): WithStyle => {
if ( ! isFeaturePluginBuild() ) { if ( typeof __experimentalGetSpacingClassesAndStyles !== 'function' ) {
return { return {
style: {}, style: {},
}; };
} }
const attributesObject = isObject( attributes ) ? attributes : {}; const attributesObject = isObject( attributes ) ? attributes : {};
const style = parseStyle( attributesObject.style ); const style = parseStyle( attributesObject.style );