From db35abd02371291dfa00562f29ea5901562da8cb Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 9 Aug 2024 19:56:49 +0900 Subject: [PATCH] DimensionControl: Add flag to remove bottom margin (#64346) * DimensionControl: Add flag to remove bottom margin * Add lint rule * Update in block-editor readme * Add changelog Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla --- .eslintrc.js | 1 + .../components/responsive-block-control/README.md | 1 + packages/components/CHANGELOG.md | 1 + packages/components/src/dimension-control/README.md | 9 +++++++++ packages/components/src/dimension-control/index.tsx | 3 +++ packages/components/src/dimension-control/types.ts | 12 +++++------- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 81408499bd34f4..cb669fb4177206 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -292,6 +292,7 @@ module.exports = { ...[ 'CheckboxControl', 'ComboboxControl', + 'DimensionControl', 'FocalPointPicker', 'RangeControl', 'SearchControl', diff --git a/packages/block-editor/src/components/responsive-block-control/README.md b/packages/block-editor/src/components/responsive-block-control/README.md index 1d99caa024a419..379e245f03ff37 100644 --- a/packages/block-editor/src/components/responsive-block-control/README.md +++ b/packages/block-editor/src/components/responsive-block-control/README.md @@ -64,6 +64,7 @@ registerBlockType( 'my-plugin/my-block', { const paddingControl = ( labelComponent, viewport ) => { return ( setPaddingSize( value ) } @@ -91,3 +92,11 @@ A callback which is triggered when a spacing size value changes (is selected/cli - **Required:** No A string of classes to be added to the control component. + +### __nextHasNoMarginBottom + +Start opting into the new margin-free styles that will become the default in a future version. + +- Type: `Boolean` +- Required: No +- Default: `false` diff --git a/packages/components/src/dimension-control/index.tsx b/packages/components/src/dimension-control/index.tsx index 8ba0de0ce0599c..114ebe987dd35d 100644 --- a/packages/components/src/dimension-control/index.tsx +++ b/packages/components/src/dimension-control/index.tsx @@ -31,6 +31,7 @@ import type { SelectControlSingleSelectionProps } from '../select-control/types' * * return ( * setPaddingSize( value ) } @@ -43,6 +44,7 @@ import type { SelectControlSingleSelectionProps } from '../select-control/types' export function DimensionControl( props: DimensionControlProps ) { const { __next40pxDefaultSize = false, + __nextHasNoMarginBottom = false, label, value, sizes = sizesTable, @@ -87,6 +89,7 @@ export function DimensionControl( props: DimensionControlProps ) { return ( & { /** * Label for the control. */ @@ -45,10 +49,4 @@ export type DimensionControlProps = { * @default '' */ className?: string; - /** - * Start opting into the larger default height that will become the default size in a future version. - * - * @default false - */ - __next40pxDefaultSize?: boolean; };