Skip to content

Commit

Permalink
Block Editor: Remove unused 'useIsDimensionsSupportValid' method
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed May 18, 2023
1 parent 6725f29 commit 41660c1
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions packages/block-editor/src/hooks/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,43 +136,3 @@ export function useCustomSides() {
version: '6.4',
} );
}

/**
* Custom hook to determine whether the sides configured in the
* block support are valid. A dimension property cannot declare
* support for a mix of axial and individual sides.
*
* @param {string} blockName Block name.
* @param {string} feature The feature custom sides relate to e.g. padding or margins.
*
* @return {boolean} If the feature has a valid configuration of sides.
*/
export function useIsDimensionsSupportValid( blockName, feature ) {
const sides = useCustomSides( blockName, feature );

if (
sides &&
sides.some( ( side ) => ALL_SIDES.includes( side ) ) &&
sides.some( ( side ) => AXIAL_SIDES.includes( side ) )
) {
// eslint-disable-next-line no-console
console.warn(
`The ${ feature } support for the "${ blockName }" block can not be configured to support both axial and arbitrary sides.`
);
return false;
}

if (
sides?.length &&
feature === 'blockGap' &&
! AXIAL_SIDES.every( ( side ) => sides.includes( side ) )
) {
// eslint-disable-next-line no-console
console.warn(
`The ${ feature } support for the "${ blockName }" block can not be configured to support arbitrary sides.`
);
return false;
}

return true;
}

0 comments on commit 41660c1

Please sign in to comment.