Add feature gate for enabling the global styles for Product Sale Badge block only for the feature plugin (https://github.com/woocommerce/woocommerce-blocks/pull/6008)

* Add feature gate for the global styles for Product Sale Badge block woocommerce/woocommerce-blocks#6007

Add feature gate for the global styles for Product Sale Badge block

* add a check for the spacing support
This commit is contained in:
Luigi Teschio 2022-03-07 18:39:11 +01:00 committed by GitHub
parent 299f5e1bfa
commit 4b80f92c02
3 changed files with 50 additions and 29 deletions

View File

@ -3,6 +3,11 @@
*/
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
/**
* Internal dependencies
*/
import { hasSpacingStyleSupport } from '../../../../utils/global-style';
export const supports = {
...( isFeaturePluginBuild() && {
color: {
@ -15,10 +20,12 @@ export const supports = {
radius: true,
__experimentalSkipSerialization: true,
},
...( hasSpacingStyleSupport() && {
spacing: {
padding: true,
__experimentalSkipSerialization: true,
},
} ),
typography: {
fontSize: true,
__experimentalFontWeight: true,

View File

@ -3,6 +3,11 @@
*/
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
/**
* Internal dependencies
*/
import { hasSpacingStyleSupport } from '../../../../utils/global-style';
export const supports = {
...( isFeaturePluginBuild() && {
__experimentalBorder: {
@ -13,10 +18,12 @@ export const supports = {
fontSize: true,
__experimentalSkipSerialization: true,
},
...( hasSpacingStyleSupport() && {
spacing: {
margin: true,
__experimentalSkipSerialization: true,
},
} ),
__experimentalSelector: '.wc-block-components-product-image',
} ),
};

View File

@ -2,6 +2,7 @@
* External dependencies
*/
import { registerBlockType } from '@wordpress/blocks';
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
/**
* Internal dependencies
@ -15,6 +16,7 @@ import {
BLOCK_DESCRIPTION as description,
} from './constants';
import { Save } from './save';
import { hasSpacingStyleSupport } from '../../../../utils/global-style';
const blockConfig = {
title,
@ -23,6 +25,7 @@ const blockConfig = {
apiVersion: 2,
supports: {
html: false,
...( isFeaturePluginBuild() && {
color: {
gradients: true,
background: true,
@ -39,11 +42,15 @@ const blockConfig = {
width: true,
__experimentalSkipSerialization: true,
},
...( hasSpacingStyleSupport() && {
spacing: {
padding: true,
__experimentalSkipSerialization: true,
},
__experimentalSelector: '.wc-block-components-product-sale-badge',
__experimentalSelector:
'.wc-block-components-product-sale-badge',
} ),
} ),
},
attributes,
edit,