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:
parent
ada39c2378
commit
90e68175cf
|
@ -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 );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue