diff --git a/packages/block-editor/src/components/spacing-sizes-control/index.js b/packages/block-editor/src/components/spacing-sizes-control/index.js index 6886670f541155..6ca143d14706ac 100644 --- a/packages/block-editor/src/components/spacing-sizes-control/index.js +++ b/packages/block-editor/src/components/spacing-sizes-control/index.js @@ -7,7 +7,7 @@ import { __experimentalVStack as VStack, } from '@wordpress/components'; import { useState } from '@wordpress/element'; -import { __, _x, sprintf } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; /** * Internal dependencies @@ -15,7 +15,7 @@ import { __, _x, sprintf } from '@wordpress/i18n'; import AxialInputControls from './input-controls/axial'; import SeparatedInputControls from './input-controls/separated'; import SingleInputControl from './input-controls/single'; -import SidesDropdown from './sides-dropdown'; +import LinkedButton from './linked-button'; import useSpacingSizes from './hooks/use-spacing-sizes'; import { ALL_SIDES, @@ -47,6 +47,10 @@ export default function SpacingSizesControl( { const [ view, setView ] = useState( getInitialView( inputValues, sides ) ); + const toggleLinked = () => { + setView( view === VIEWS.axial ? VIEWS.custom : VIEWS.axial ); + }; + const handleOnChange = ( nextValue ) => { const newValues = { ...values, ...nextValue }; onChange( newValues ); @@ -91,12 +95,6 @@ export default function SpacingSizesControl( { sideLabel ).trim(); - const dropdownLabelText = sprintf( - // translators: %s: The current spacing property e.g. "Padding", "Margin". - _x( '%s options', 'Button label to reveal side configuration options' ), - labelProp - ); - return (
@@ -107,11 +105,10 @@ export default function SpacingSizesControl( { { label } { ! hasOneSide && ! hasOnlyAxialSides && ( - ) } diff --git a/packages/block-editor/src/components/spacing-sizes-control/linked-button.js b/packages/block-editor/src/components/spacing-sizes-control/linked-button.js new file mode 100644 index 00000000000000..e9ca68aaa2b31d --- /dev/null +++ b/packages/block-editor/src/components/spacing-sizes-control/linked-button.js @@ -0,0 +1,32 @@ +/** + * WordPress dependencies + */ +import { Button, Tooltip } from '@wordpress/components'; +import { link, linkOff } from '@wordpress/icons'; +import { __, sprintf } from '@wordpress/i18n'; + +export default function LinkedButton( { isLinked, ...props } ) { + const label = isLinked + ? sprintf( + // translators: 1. Type of spacing being modified (padding, margin, etc). + __( 'Unlink %1$s' ), + props.label.toLowerCase() + ).trim() + : sprintf( + // translators: 1. Type of spacing being modified (padding, margin, etc). + __( 'Link %1$s' ), + props.label.toLowerCase() + ).trim(); + + return ( + +