diff --git a/assets/js/atomic/blocks/product-elements/sale-badge/block.js b/assets/js/atomic/blocks/product-elements/sale-badge/block.js index d9e9041ee37..aaa7281ec51 100644 --- a/assets/js/atomic/blocks/product-elements/sale-badge/block.js +++ b/assets/js/atomic/blocks/product-elements/sale-badge/block.js @@ -15,6 +15,11 @@ import { withProductDataContext } from '@woocommerce/shared-hocs'; * Internal dependencies */ import './style.scss'; +import { + useBorderProps, + useColorProps, + useSpacingProps, +} from '../../../../hooks/style-attributes'; /** * Product Sale Badge Block Component. @@ -24,9 +29,14 @@ import './style.scss'; * @param {string} [props.align] Alignment of the badge. * @return {*} The component. */ -const Block = ( { className, align } ) => { +const Block = ( props ) => { + const { className, align } = props; + const { parentClassName } = useInnerBlockLayoutContext(); const { product } = useProductDataContext(); + const borderProps = useBorderProps( props ); + const colorProps = useColorProps( props ); + const spacingProps = useSpacingProps( props ); if ( ! product.id || ! product.on_sale ) { return null; @@ -45,8 +55,15 @@ const Block = ( { className, align } ) => { alignClass, { [ `${ parentClassName }__product-onsale` ]: parentClassName, - } + }, + borderProps.className, + colorProps.className ) } + style={ { + ...borderProps.style, + ...colorProps.style, + ...spacingProps.style, + } } >