Skip to content

Commit

Permalink
NumberControl: Add lint rule for 40px size prop usage (#64561)
Browse files Browse the repository at this point in the history
Co-authored-by: mirka <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
4 people authored Aug 16, 2024
1 parent 65da212 commit 78722b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ module.exports = {
'CustomSelectControl',
'DimensionControl',
'FontSizePicker',
'NumberControl',
'ToggleGroupControl',
].map( ( componentName ) => ( {
// Falsy `__next40pxDefaultSize` without a non-default `size` prop.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ The value of the line height.

A callback function that handles the application of the line height value.

#### `__next40pxDefaultSize`

- **Type:** `boolean`
- **Default:** `false`

Start opting into the larger default height that will become the default size in a future version.

## Related components

Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
} from './utils';

const LineHeightControl = ( {
/** Start opting into the larger default height that will become the default size in a future version. */
__next40pxDefaultSize = false,
value: lineHeight,
onChange,
__unstableInputWidth = '60px',
Expand Down Expand Up @@ -91,6 +93,7 @@ const LineHeightControl = ( {
<div className="block-editor-line-height-control">
<NumberControl
{ ...otherProps }
__next40pxDefaultSize={ __next40pxDefaultSize }
__unstableInputWidth={ __unstableInputWidth }
__unstableStateReducer={ stateReducer }
onChange={ handleOnChange }
Expand Down

0 comments on commit 78722b9

Please sign in to comment.