Add additional size units to product image element (#50770)

* Add additional size units to product image element

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Roy Ho 2024-08-22 06:32:03 -07:00 committed by GitHub
parent 7ba0fb4fde
commit 320c165cb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 12 deletions

View File

@ -43,6 +43,33 @@ const scaleHelp: Record< string, string > = {
),
};
const sizeUnits: { value: string; label: string }[] = [
{
value: 'px',
label: 'px',
},
{
value: 'em',
label: 'em',
},
{
value: 'rem',
label: 'rem',
},
{
value: '%',
label: '%',
},
{
value: 'vw',
label: 'vw',
},
{
value: 'vh',
label: 'vh',
},
];
export const ImageSizeSettings = ( {
scale,
width,
@ -60,12 +87,7 @@ export const ImageSizeSettings = ( {
setAttributes( { height: value } );
} }
value={ height }
units={ [
{
value: 'px',
label: 'px',
},
] }
units={ sizeUnits }
/>
<UnitControl
label={ __( 'Width', 'woocommerce' ) }
@ -73,12 +95,7 @@ export const ImageSizeSettings = ( {
setAttributes( { width: value } );
} }
value={ width }
units={ [
{
value: 'px',
label: 'px',
},
] }
units={ sizeUnits }
/>
{ height && (
<ToolsPanelItem

View File

@ -0,0 +1,4 @@
Significance: patch
Type: enhancement
Add additional sizing units for product image block