Skip to content

Commit

Permalink
LineHeightControl: Deprecate 36px default size (#67850)
Browse files Browse the repository at this point in the history
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent b74283b commit 70c6cb7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const MyLineHeightControl = () => (
<LineHeightControl
value={ lineHeight }
onChange={ onChange }
__next40pxDefaultSize
/>
);
```
Expand Down
12 changes: 12 additions & 0 deletions packages/block-editor/src/components/line-height-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { __experimentalNumberControl as NumberControl } from '@wordpress/components';
import deprecated from '@wordpress/deprecated';

/**
* Internal dependencies
Expand Down Expand Up @@ -89,6 +90,17 @@ const LineHeightControl = ( {
onChange( `${ nextValue }` );
};

if (
! __next40pxDefaultSize &&
( otherProps.size === undefined || otherProps.size === 'default' )
) {
deprecated( `36px default size for wp.blockEditor.LineHeightControl`, {
since: '6.8',
version: '7.1',
hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.',
} );
}

return (
<div className="block-editor-line-height-control">
<NumberControl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const Template = ( props ) => {

export const Default = Template.bind( {} );
Default.args = {
__next40pxDefaultSize: true,
__unstableInputWidth: '100px',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ const SPIN = STEP * SPIN_FACTOR;

const ControlledLineHeightControl = () => {
const [ value, setValue ] = useState();
return <LineHeightControl value={ value } onChange={ setValue } />;
return (
<LineHeightControl
value={ value }
onChange={ setValue }
__next40pxDefaultSize
/>
);
};

describe( 'LineHeightControl', () => {
Expand Down

1 comment on commit 70c6cb7

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 70c6cb7.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12303201000
📝 Reported issues:

Please sign in to comment.