diff --git a/packages/block-editor/src/components/dimension-control/index.js b/packages/block-editor/src/components/dimension-control/index.js index 3110295a8cfb22..ae3b6a43ed32b4 100644 --- a/packages/block-editor/src/components/dimension-control/index.js +++ b/packages/block-editor/src/components/dimension-control/index.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { startCase } from 'lodash'; - /** * WordPress dependencies */ @@ -12,15 +7,14 @@ import { BaseControl, Tooltip, } from '@wordpress/components'; +import { __, sprintf } from '@wordpress/i18n'; /** * Internal dependencies */ import sizesTable from './sizes'; -function DimensionControl( { type, attributes, setAttributes, clientId } ) { - const humanTypeName = startCase( type ); - +function DimensionControl( { title, property, attributes, setAttributes, clientId } ) { const onChangeSpacingSize = ( event ) => { const theSize = sizesTable.find( ( size ) => event.target.value === size.slug ); @@ -28,36 +22,36 @@ function DimensionControl( { type, attributes, setAttributes, clientId } ) { return; } - if ( attributes[ `${ type }Size` ] === theSize.slug ) { + if ( attributes[ `${ property }Size` ] === theSize.slug ) { setAttributes( { - [ `${ type }Size` ]: '', - [ `${ type }Top` ]: 0, - [ `${ type }Right` ]: 0, - [ `${ type }Left` ]: 0, - [ `${ type }Bottom` ]: 0, + [ `${ property }Size` ]: '', + [ `${ property }Top` ]: 0, + [ `${ property }Right` ]: 0, + [ `${ property }Left` ]: 0, + [ `${ property }Bottom` ]: 0, } ); } else { setAttributes( { - [ `${ type }Size` ]: theSize.slug, - [ `${ type }Top` ]: theSize.size, - [ `${ type }Right` ]: theSize.size, - [ `${ type }Left` ]: theSize.size, - [ `${ type }Bottom` ]: theSize.size, + [ `${ property }Size` ]: theSize.slug, + [ `${ property }Top` ]: theSize.size, + [ `${ property }Right` ]: theSize.size, + [ `${ property }Left` ]: theSize.size, + [ `${ property }Bottom` ]: theSize.size, } ); } }; // Todo - update with unique Block instance ID? - const controlId = `block-spacing-${ type }-${ clientId }`; + const controlId = `block-spacing-${ property }-${ clientId }`; return ( - { humanTypeName } + { title }